/*
Daytona

Daytona AI platform API Docs

API version: 1.0
Contact: support@daytona.com
*/

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

package apiclient

import (
	"encoding/json"
	"fmt"
)

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

// CreateUser struct for CreateUser
type CreateUser struct {
	Id string `json:"id"`
	Name string `json:"name"`
	Email *string `json:"email,omitempty"`
	PersonalOrganizationQuota *CreateOrganizationQuota `json:"personalOrganizationQuota,omitempty"`
	PersonalOrganizationDefaultRegionId *string `json:"personalOrganizationDefaultRegionId,omitempty"`
	Role *string `json:"role,omitempty"`
	EmailVerified *bool `json:"emailVerified,omitempty"`
	AdditionalProperties map[string]interface{}
}

type _CreateUser CreateUser

// NewCreateUser instantiates a new CreateUser 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 NewCreateUser(id string, name string) *CreateUser {
	this := CreateUser{}
	this.Id = id
	this.Name = name
	return &this
}

// NewCreateUserWithDefaults instantiates a new CreateUser 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 NewCreateUserWithDefaults() *CreateUser {
	this := CreateUser{}
	return &this
}

// GetId returns the Id field value
func (o *CreateUser) GetId() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.Id
}

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

// SetId sets field value
func (o *CreateUser) SetId(v string) {
	o.Id = v
}

// GetName returns the Name field value
func (o *CreateUser) GetName() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.Name
}

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

// SetName sets field value
func (o *CreateUser) SetName(v string) {
	o.Name = v
}

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

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

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

	return false
}

// SetEmail gets a reference to the given string and assigns it to the Email field.
func (o *CreateUser) SetEmail(v string) {
	o.Email = &v
}

// GetPersonalOrganizationQuota returns the PersonalOrganizationQuota field value if set, zero value otherwise.
func (o *CreateUser) GetPersonalOrganizationQuota() CreateOrganizationQuota {
	if o == nil || IsNil(o.PersonalOrganizationQuota) {
		var ret CreateOrganizationQuota
		return ret
	}
	return *o.PersonalOrganizationQuota
}

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

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

	return false
}

// SetPersonalOrganizationQuota gets a reference to the given CreateOrganizationQuota and assigns it to the PersonalOrganizationQuota field.
func (o *CreateUser) SetPersonalOrganizationQuota(v CreateOrganizationQuota) {
	o.PersonalOrganizationQuota = &v
}

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

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

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

	return false
}

// SetPersonalOrganizationDefaultRegionId gets a reference to the given string and assigns it to the PersonalOrganizationDefaultRegionId field.
func (o *CreateUser) SetPersonalOrganizationDefaultRegionId(v string) {
	o.PersonalOrganizationDefaultRegionId = &v
}

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

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

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

	return false
}

// SetRole gets a reference to the given string and assigns it to the Role field.
func (o *CreateUser) SetRole(v string) {
	o.Role = &v
}

// GetEmailVerified returns the EmailVerified field value if set, zero value otherwise.
func (o *CreateUser) GetEmailVerified() bool {
	if o == nil || IsNil(o.EmailVerified) {
		var ret bool
		return ret
	}
	return *o.EmailVerified
}

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

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

	return false
}

// SetEmailVerified gets a reference to the given bool and assigns it to the EmailVerified field.
func (o *CreateUser) SetEmailVerified(v bool) {
	o.EmailVerified = &v
}

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

func (o CreateUser) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	toSerialize["id"] = o.Id
	toSerialize["name"] = o.Name
	if !IsNil(o.Email) {
		toSerialize["email"] = o.Email
	}
	if !IsNil(o.PersonalOrganizationQuota) {
		toSerialize["personalOrganizationQuota"] = o.PersonalOrganizationQuota
	}
	if !IsNil(o.PersonalOrganizationDefaultRegionId) {
		toSerialize["personalOrganizationDefaultRegionId"] = o.PersonalOrganizationDefaultRegionId
	}
	if !IsNil(o.Role) {
		toSerialize["role"] = o.Role
	}
	if !IsNil(o.EmailVerified) {
		toSerialize["emailVerified"] = o.EmailVerified
	}

	for key, value := range o.AdditionalProperties {
		toSerialize[key] = value
	}

	return toSerialize, nil
}

func (o *CreateUser) 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{
		"id",
		"name",
	}

	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)
		}
	}

	varCreateUser := _CreateUser{}

	err = json.Unmarshal(data, &varCreateUser)

	if err != nil {
		return err
	}

	*o = CreateUser(varCreateUser)

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

	if err = json.Unmarshal(data, &additionalProperties); err == nil {
		delete(additionalProperties, "id")
		delete(additionalProperties, "name")
		delete(additionalProperties, "email")
		delete(additionalProperties, "personalOrganizationQuota")
		delete(additionalProperties, "personalOrganizationDefaultRegionId")
		delete(additionalProperties, "role")
		delete(additionalProperties, "emailVerified")
		o.AdditionalProperties = additionalProperties
	}

	return err
}

type NullableCreateUser struct {
	value *CreateUser
	isSet bool
}

func (v NullableCreateUser) Get() *CreateUser {
	return v.value
}

func (v *NullableCreateUser) Set(val *CreateUser) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableCreateUser(val *CreateUser) *NullableCreateUser {
	return &NullableCreateUser{value: val, isSet: true}
}

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

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


