/*
1Backend

AI-native microservices platform.

API version: 0.8.2
Contact: sales@singulatron.com
*/

// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.

package openapi

import (
	"encoding/json"
	"bytes"
	"fmt"
)

// checks if the UserSvcEnrollInput type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &UserSvcEnrollInput{}

// UserSvcEnrollInput struct for UserSvcEnrollInput
type UserSvcEnrollInput struct {
	AppHost *string `json:"appHost,omitempty"`
	// ContactId is the the recipient of the enroll. If the user is already registered, the role is assigned immediately; otherwise, it is applied upon registration.
	ContactId *string `json:"contactId,omitempty"`
	Id *string `json:"id,omitempty"`
	Role string `json:"role"`
	// UserId is the recipient of the enroll. If the user is already registered, the role is assigned immediately; otherwise, it is applied upon registration.
	UserId *string `json:"userId,omitempty"`
}

type _UserSvcEnrollInput UserSvcEnrollInput

// NewUserSvcEnrollInput instantiates a new UserSvcEnrollInput object
// This constructor will assign default values to properties that have it defined,
// and makes sure properties required by API are set, but the set of arguments
// will change when the set of required properties is changed
func NewUserSvcEnrollInput(role string) *UserSvcEnrollInput {
	this := UserSvcEnrollInput{}
	this.Role = role
	return &this
}

// NewUserSvcEnrollInputWithDefaults instantiates a new UserSvcEnrollInput object
// This constructor will only assign default values to properties that have it defined,
// but it doesn't guarantee that properties required by API are set
func NewUserSvcEnrollInputWithDefaults() *UserSvcEnrollInput {
	this := UserSvcEnrollInput{}
	return &this
}

// GetAppHost returns the AppHost field value if set, zero value otherwise.
func (o *UserSvcEnrollInput) GetAppHost() string {
	if o == nil || IsNil(o.AppHost) {
		var ret string
		return ret
	}
	return *o.AppHost
}

// GetAppHostOk returns a tuple with the AppHost field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *UserSvcEnrollInput) GetAppHostOk() (*string, bool) {
	if o == nil || IsNil(o.AppHost) {
		return nil, false
	}
	return o.AppHost, true
}

// HasAppHost returns a boolean if a field has been set.
func (o *UserSvcEnrollInput) HasAppHost() bool {
	if o != nil && !IsNil(o.AppHost) {
		return true
	}

	return false
}

// SetAppHost gets a reference to the given string and assigns it to the AppHost field.
func (o *UserSvcEnrollInput) SetAppHost(v string) {
	o.AppHost = &v
}

// GetContactId returns the ContactId field value if set, zero value otherwise.
func (o *UserSvcEnrollInput) GetContactId() string {
	if o == nil || IsNil(o.ContactId) {
		var ret string
		return ret
	}
	return *o.ContactId
}

// GetContactIdOk returns a tuple with the ContactId field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *UserSvcEnrollInput) GetContactIdOk() (*string, bool) {
	if o == nil || IsNil(o.ContactId) {
		return nil, false
	}
	return o.ContactId, true
}

// HasContactId returns a boolean if a field has been set.
func (o *UserSvcEnrollInput) HasContactId() bool {
	if o != nil && !IsNil(o.ContactId) {
		return true
	}

	return false
}

// SetContactId gets a reference to the given string and assigns it to the ContactId field.
func (o *UserSvcEnrollInput) SetContactId(v string) {
	o.ContactId = &v
}

// GetId returns the Id field value if set, zero value otherwise.
func (o *UserSvcEnrollInput) GetId() string {
	if o == nil || IsNil(o.Id) {
		var ret string
		return ret
	}
	return *o.Id
}

// GetIdOk returns a tuple with the Id field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *UserSvcEnrollInput) GetIdOk() (*string, bool) {
	if o == nil || IsNil(o.Id) {
		return nil, false
	}
	return o.Id, true
}

// HasId returns a boolean if a field has been set.
func (o *UserSvcEnrollInput) HasId() bool {
	if o != nil && !IsNil(o.Id) {
		return true
	}

	return false
}

// SetId gets a reference to the given string and assigns it to the Id field.
func (o *UserSvcEnrollInput) SetId(v string) {
	o.Id = &v
}

// GetRole returns the Role field value
func (o *UserSvcEnrollInput) GetRole() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.Role
}

// GetRoleOk returns a tuple with the Role field value
// and a boolean to check if the value has been set.
func (o *UserSvcEnrollInput) GetRoleOk() (*string, bool) {
	if o == nil {
		return nil, false
	}
	return &o.Role, true
}

// SetRole sets field value
func (o *UserSvcEnrollInput) SetRole(v string) {
	o.Role = v
}

// GetUserId returns the UserId field value if set, zero value otherwise.
func (o *UserSvcEnrollInput) GetUserId() string {
	if o == nil || IsNil(o.UserId) {
		var ret string
		return ret
	}
	return *o.UserId
}

// GetUserIdOk returns a tuple with the UserId field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *UserSvcEnrollInput) GetUserIdOk() (*string, bool) {
	if o == nil || IsNil(o.UserId) {
		return nil, false
	}
	return o.UserId, true
}

// HasUserId returns a boolean if a field has been set.
func (o *UserSvcEnrollInput) HasUserId() bool {
	if o != nil && !IsNil(o.UserId) {
		return true
	}

	return false
}

// SetUserId gets a reference to the given string and assigns it to the UserId field.
func (o *UserSvcEnrollInput) SetUserId(v string) {
	o.UserId = &v
}

func (o UserSvcEnrollInput) MarshalJSON() ([]byte, error) {
	toSerialize,err := o.ToMap()
	if err != nil {
		return []byte{}, err
	}
	return json.Marshal(toSerialize)
}

func (o UserSvcEnrollInput) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	if !IsNil(o.AppHost) {
		toSerialize["appHost"] = o.AppHost
	}
	if !IsNil(o.ContactId) {
		toSerialize["contactId"] = o.ContactId
	}
	if !IsNil(o.Id) {
		toSerialize["id"] = o.Id
	}
	toSerialize["role"] = o.Role
	if !IsNil(o.UserId) {
		toSerialize["userId"] = o.UserId
	}
	return toSerialize, nil
}

func (o *UserSvcEnrollInput) UnmarshalJSON(data []byte) (err error) {
	// This validates that all required properties are included in the JSON object
	// by unmarshalling the object into a generic map with string keys and checking
	// that every required field exists as a key in the generic map.
	requiredProperties := []string{
		"role",
	}

	allProperties := make(map[string]interface{})

	err = json.Unmarshal(data, &allProperties)

	if err != nil {
		return err;
	}

	for _, requiredProperty := range(requiredProperties) {
		if _, exists := allProperties[requiredProperty]; !exists {
			return fmt.Errorf("no value given for required property %v", requiredProperty)
		}
	}

	varUserSvcEnrollInput := _UserSvcEnrollInput{}

	decoder := json.NewDecoder(bytes.NewReader(data))
	decoder.DisallowUnknownFields()
	err = decoder.Decode(&varUserSvcEnrollInput)

	if err != nil {
		return err
	}

	*o = UserSvcEnrollInput(varUserSvcEnrollInput)

	return err
}

type NullableUserSvcEnrollInput struct {
	value *UserSvcEnrollInput
	isSet bool
}

func (v NullableUserSvcEnrollInput) Get() *UserSvcEnrollInput {
	return v.value
}

func (v *NullableUserSvcEnrollInput) Set(val *UserSvcEnrollInput) {
	v.value = val
	v.isSet = true
}

func (v NullableUserSvcEnrollInput) IsSet() bool {
	return v.isSet
}

func (v *NullableUserSvcEnrollInput) Unset() {
	v.value = nil
	v.isSet = false
}

func NewNullableUserSvcEnrollInput(val *UserSvcEnrollInput) *NullableUserSvcEnrollInput {
	return &NullableUserSvcEnrollInput{value: val, isSet: true}
}

func (v NullableUserSvcEnrollInput) MarshalJSON() ([]byte, error) {
	return json.Marshal(v.value)
}

func (v *NullableUserSvcEnrollInput) UnmarshalJSON(src []byte) error {
	v.isSet = true
	return json.Unmarshal(src, &v.value)
}


