/*
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"
	"time"
	"fmt"
)

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

// OrganizationUser struct for OrganizationUser
type OrganizationUser struct {
	// User ID
	UserId string `json:"userId"`
	// Organization ID
	OrganizationId string `json:"organizationId"`
	// User name
	Name string `json:"name"`
	// User email
	Email string `json:"email"`
	// Member role
	Role string `json:"role"`
	// Roles assigned to the user
	AssignedRoles []OrganizationRole `json:"assignedRoles"`
	// Creation timestamp
	CreatedAt time.Time `json:"createdAt"`
	// Last update timestamp
	UpdatedAt time.Time `json:"updatedAt"`
	AdditionalProperties map[string]interface{}
}

type _OrganizationUser OrganizationUser

// NewOrganizationUser instantiates a new OrganizationUser 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 NewOrganizationUser(userId string, organizationId string, name string, email string, role string, assignedRoles []OrganizationRole, createdAt time.Time, updatedAt time.Time) *OrganizationUser {
	this := OrganizationUser{}
	this.UserId = userId
	this.OrganizationId = organizationId
	this.Name = name
	this.Email = email
	this.Role = role
	this.AssignedRoles = assignedRoles
	this.CreatedAt = createdAt
	this.UpdatedAt = updatedAt
	return &this
}

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

// GetUserId returns the UserId field value
func (o *OrganizationUser) GetUserId() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.UserId
}

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

// SetUserId sets field value
func (o *OrganizationUser) SetUserId(v string) {
	o.UserId = v
}

// GetOrganizationId returns the OrganizationId field value
func (o *OrganizationUser) GetOrganizationId() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.OrganizationId
}

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

// SetOrganizationId sets field value
func (o *OrganizationUser) SetOrganizationId(v string) {
	o.OrganizationId = v
}

// GetName returns the Name field value
func (o *OrganizationUser) 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 *OrganizationUser) GetNameOk() (*string, bool) {
	if o == nil {
		return nil, false
	}
	return &o.Name, true
}

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

// GetEmail returns the Email field value
func (o *OrganizationUser) GetEmail() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.Email
}

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

// SetEmail sets field value
func (o *OrganizationUser) SetEmail(v string) {
	o.Email = v
}

// GetRole returns the Role field value
func (o *OrganizationUser) 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 *OrganizationUser) GetRoleOk() (*string, bool) {
	if o == nil {
		return nil, false
	}
	return &o.Role, true
}

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

// GetAssignedRoles returns the AssignedRoles field value
func (o *OrganizationUser) GetAssignedRoles() []OrganizationRole {
	if o == nil {
		var ret []OrganizationRole
		return ret
	}

	return o.AssignedRoles
}

// GetAssignedRolesOk returns a tuple with the AssignedRoles field value
// and a boolean to check if the value has been set.
func (o *OrganizationUser) GetAssignedRolesOk() ([]OrganizationRole, bool) {
	if o == nil {
		return nil, false
	}
	return o.AssignedRoles, true
}

// SetAssignedRoles sets field value
func (o *OrganizationUser) SetAssignedRoles(v []OrganizationRole) {
	o.AssignedRoles = v
}

// GetCreatedAt returns the CreatedAt field value
func (o *OrganizationUser) GetCreatedAt() time.Time {
	if o == nil {
		var ret time.Time
		return ret
	}

	return o.CreatedAt
}

// GetCreatedAtOk returns a tuple with the CreatedAt field value
// and a boolean to check if the value has been set.
func (o *OrganizationUser) GetCreatedAtOk() (*time.Time, bool) {
	if o == nil {
		return nil, false
	}
	return &o.CreatedAt, true
}

// SetCreatedAt sets field value
func (o *OrganizationUser) SetCreatedAt(v time.Time) {
	o.CreatedAt = v
}

// GetUpdatedAt returns the UpdatedAt field value
func (o *OrganizationUser) GetUpdatedAt() time.Time {
	if o == nil {
		var ret time.Time
		return ret
	}

	return o.UpdatedAt
}

// GetUpdatedAtOk returns a tuple with the UpdatedAt field value
// and a boolean to check if the value has been set.
func (o *OrganizationUser) GetUpdatedAtOk() (*time.Time, bool) {
	if o == nil {
		return nil, false
	}
	return &o.UpdatedAt, true
}

// SetUpdatedAt sets field value
func (o *OrganizationUser) SetUpdatedAt(v time.Time) {
	o.UpdatedAt = v
}

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

func (o OrganizationUser) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	toSerialize["userId"] = o.UserId
	toSerialize["organizationId"] = o.OrganizationId
	toSerialize["name"] = o.Name
	toSerialize["email"] = o.Email
	toSerialize["role"] = o.Role
	toSerialize["assignedRoles"] = o.AssignedRoles
	toSerialize["createdAt"] = o.CreatedAt
	toSerialize["updatedAt"] = o.UpdatedAt

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

	return toSerialize, nil
}

func (o *OrganizationUser) 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{
		"userId",
		"organizationId",
		"name",
		"email",
		"role",
		"assignedRoles",
		"createdAt",
		"updatedAt",
	}

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

	varOrganizationUser := _OrganizationUser{}

	err = json.Unmarshal(data, &varOrganizationUser)

	if err != nil {
		return err
	}

	*o = OrganizationUser(varOrganizationUser)

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

	if err = json.Unmarshal(data, &additionalProperties); err == nil {
		delete(additionalProperties, "userId")
		delete(additionalProperties, "organizationId")
		delete(additionalProperties, "name")
		delete(additionalProperties, "email")
		delete(additionalProperties, "role")
		delete(additionalProperties, "assignedRoles")
		delete(additionalProperties, "createdAt")
		delete(additionalProperties, "updatedAt")
		o.AdditionalProperties = additionalProperties
	}

	return err
}

type NullableOrganizationUser struct {
	value *OrganizationUser
	isSet bool
}

func (v NullableOrganizationUser) Get() *OrganizationUser {
	return v.value
}

func (v *NullableOrganizationUser) Set(val *OrganizationUser) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableOrganizationUser(val *OrganizationUser) *NullableOrganizationUser {
	return &NullableOrganizationUser{value: val, isSet: true}
}

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

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


