/*
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 UpdateOrganizationInvitation type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &UpdateOrganizationInvitation{}

// UpdateOrganizationInvitation struct for UpdateOrganizationInvitation
type UpdateOrganizationInvitation struct {
	// Organization member role
	Role string `json:"role"`
	// Array of role IDs
	AssignedRoleIds []string `json:"assignedRoleIds"`
	// Expiration date of the invitation
	ExpiresAt *time.Time `json:"expiresAt,omitempty"`
	AdditionalProperties map[string]interface{}
}

type _UpdateOrganizationInvitation UpdateOrganizationInvitation

// NewUpdateOrganizationInvitation instantiates a new UpdateOrganizationInvitation 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 NewUpdateOrganizationInvitation(role string, assignedRoleIds []string) *UpdateOrganizationInvitation {
	this := UpdateOrganizationInvitation{}
	this.Role = role
	this.AssignedRoleIds = assignedRoleIds
	return &this
}

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

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

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

// GetAssignedRoleIds returns the AssignedRoleIds field value
func (o *UpdateOrganizationInvitation) GetAssignedRoleIds() []string {
	if o == nil {
		var ret []string
		return ret
	}

	return o.AssignedRoleIds
}

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

// SetAssignedRoleIds sets field value
func (o *UpdateOrganizationInvitation) SetAssignedRoleIds(v []string) {
	o.AssignedRoleIds = v
}

// GetExpiresAt returns the ExpiresAt field value if set, zero value otherwise.
func (o *UpdateOrganizationInvitation) GetExpiresAt() time.Time {
	if o == nil || IsNil(o.ExpiresAt) {
		var ret time.Time
		return ret
	}
	return *o.ExpiresAt
}

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

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

	return false
}

// SetExpiresAt gets a reference to the given time.Time and assigns it to the ExpiresAt field.
func (o *UpdateOrganizationInvitation) SetExpiresAt(v time.Time) {
	o.ExpiresAt = &v
}

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

func (o UpdateOrganizationInvitation) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	toSerialize["role"] = o.Role
	toSerialize["assignedRoleIds"] = o.AssignedRoleIds
	if !IsNil(o.ExpiresAt) {
		toSerialize["expiresAt"] = o.ExpiresAt
	}

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

	return toSerialize, nil
}

func (o *UpdateOrganizationInvitation) 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",
		"assignedRoleIds",
	}

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

	varUpdateOrganizationInvitation := _UpdateOrganizationInvitation{}

	err = json.Unmarshal(data, &varUpdateOrganizationInvitation)

	if err != nil {
		return err
	}

	*o = UpdateOrganizationInvitation(varUpdateOrganizationInvitation)

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

	if err = json.Unmarshal(data, &additionalProperties); err == nil {
		delete(additionalProperties, "role")
		delete(additionalProperties, "assignedRoleIds")
		delete(additionalProperties, "expiresAt")
		o.AdditionalProperties = additionalProperties
	}

	return err
}

type NullableUpdateOrganizationInvitation struct {
	value *UpdateOrganizationInvitation
	isSet bool
}

func (v NullableUpdateOrganizationInvitation) Get() *UpdateOrganizationInvitation {
	return v.value
}

func (v *NullableUpdateOrganizationInvitation) Set(val *UpdateOrganizationInvitation) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableUpdateOrganizationInvitation(val *UpdateOrganizationInvitation) *NullableUpdateOrganizationInvitation {
	return &NullableUpdateOrganizationInvitation{value: val, isSet: true}
}

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

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


