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

// UpdateOrganizationMemberAccess struct for UpdateOrganizationMemberAccess
type UpdateOrganizationMemberAccess struct {
	// Organization member role
	Role string `json:"role"`
	// Array of assigned role IDs
	AssignedRoleIds []string `json:"assignedRoleIds"`
	AdditionalProperties map[string]interface{}
}

type _UpdateOrganizationMemberAccess UpdateOrganizationMemberAccess

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

// NewUpdateOrganizationMemberAccessWithDefaults instantiates a new UpdateOrganizationMemberAccess 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 NewUpdateOrganizationMemberAccessWithDefaults() *UpdateOrganizationMemberAccess {
	this := UpdateOrganizationMemberAccess{}
	var role string = "member"
	this.Role = role
	return &this
}

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

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

// GetAssignedRoleIds returns the AssignedRoleIds field value
func (o *UpdateOrganizationMemberAccess) 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 *UpdateOrganizationMemberAccess) GetAssignedRoleIdsOk() ([]string, bool) {
	if o == nil {
		return nil, false
	}
	return o.AssignedRoleIds, true
}

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

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

func (o UpdateOrganizationMemberAccess) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	toSerialize["role"] = o.Role
	toSerialize["assignedRoleIds"] = o.AssignedRoleIds

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

	return toSerialize, nil
}

func (o *UpdateOrganizationMemberAccess) 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)
		}
	}

	varUpdateOrganizationMemberAccess := _UpdateOrganizationMemberAccess{}

	err = json.Unmarshal(data, &varUpdateOrganizationMemberAccess)

	if err != nil {
		return err
	}

	*o = UpdateOrganizationMemberAccess(varUpdateOrganizationMemberAccess)

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

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

	return err
}

type NullableUpdateOrganizationMemberAccess struct {
	value *UpdateOrganizationMemberAccess
	isSet bool
}

func (v NullableUpdateOrganizationMemberAccess) Get() *UpdateOrganizationMemberAccess {
	return v.value
}

func (v *NullableUpdateOrganizationMemberAccess) Set(val *UpdateOrganizationMemberAccess) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableUpdateOrganizationMemberAccess(val *UpdateOrganizationMemberAccess) *NullableUpdateOrganizationMemberAccess {
	return &NullableUpdateOrganizationMemberAccess{value: val, isSet: true}
}

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

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


