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

// UpdateOrganizationRegionQuota struct for UpdateOrganizationRegionQuota
type UpdateOrganizationRegionQuota struct {
	TotalCpuQuota NullableFloat32 `json:"totalCpuQuota"`
	TotalMemoryQuota NullableFloat32 `json:"totalMemoryQuota"`
	TotalDiskQuota NullableFloat32 `json:"totalDiskQuota"`
	MaxCpuPerSandbox NullableFloat32 `json:"maxCpuPerSandbox,omitempty"`
	MaxMemoryPerSandbox NullableFloat32 `json:"maxMemoryPerSandbox,omitempty"`
	MaxDiskPerSandbox NullableFloat32 `json:"maxDiskPerSandbox,omitempty"`
	MaxDiskPerNonEphemeralSandbox NullableFloat32 `json:"maxDiskPerNonEphemeralSandbox,omitempty"`
	AdditionalProperties map[string]interface{}
}

type _UpdateOrganizationRegionQuota UpdateOrganizationRegionQuota

// NewUpdateOrganizationRegionQuota instantiates a new UpdateOrganizationRegionQuota 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 NewUpdateOrganizationRegionQuota(totalCpuQuota NullableFloat32, totalMemoryQuota NullableFloat32, totalDiskQuota NullableFloat32) *UpdateOrganizationRegionQuota {
	this := UpdateOrganizationRegionQuota{}
	this.TotalCpuQuota = totalCpuQuota
	this.TotalMemoryQuota = totalMemoryQuota
	this.TotalDiskQuota = totalDiskQuota
	return &this
}

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

// GetTotalCpuQuota returns the TotalCpuQuota field value
// If the value is explicit nil, the zero value for float32 will be returned
func (o *UpdateOrganizationRegionQuota) GetTotalCpuQuota() float32 {
	if o == nil || o.TotalCpuQuota.Get() == nil {
		var ret float32
		return ret
	}

	return *o.TotalCpuQuota.Get()
}

// GetTotalCpuQuotaOk returns a tuple with the TotalCpuQuota field value
// and a boolean to check if the value has been set.
// NOTE: If the value is an explicit nil, `nil, true` will be returned
func (o *UpdateOrganizationRegionQuota) GetTotalCpuQuotaOk() (*float32, bool) {
	if o == nil {
		return nil, false
	}
	return o.TotalCpuQuota.Get(), o.TotalCpuQuota.IsSet()
}

// SetTotalCpuQuota sets field value
func (o *UpdateOrganizationRegionQuota) SetTotalCpuQuota(v float32) {
	o.TotalCpuQuota.Set(&v)
}

// GetTotalMemoryQuota returns the TotalMemoryQuota field value
// If the value is explicit nil, the zero value for float32 will be returned
func (o *UpdateOrganizationRegionQuota) GetTotalMemoryQuota() float32 {
	if o == nil || o.TotalMemoryQuota.Get() == nil {
		var ret float32
		return ret
	}

	return *o.TotalMemoryQuota.Get()
}

// GetTotalMemoryQuotaOk returns a tuple with the TotalMemoryQuota field value
// and a boolean to check if the value has been set.
// NOTE: If the value is an explicit nil, `nil, true` will be returned
func (o *UpdateOrganizationRegionQuota) GetTotalMemoryQuotaOk() (*float32, bool) {
	if o == nil {
		return nil, false
	}
	return o.TotalMemoryQuota.Get(), o.TotalMemoryQuota.IsSet()
}

// SetTotalMemoryQuota sets field value
func (o *UpdateOrganizationRegionQuota) SetTotalMemoryQuota(v float32) {
	o.TotalMemoryQuota.Set(&v)
}

// GetTotalDiskQuota returns the TotalDiskQuota field value
// If the value is explicit nil, the zero value for float32 will be returned
func (o *UpdateOrganizationRegionQuota) GetTotalDiskQuota() float32 {
	if o == nil || o.TotalDiskQuota.Get() == nil {
		var ret float32
		return ret
	}

	return *o.TotalDiskQuota.Get()
}

// GetTotalDiskQuotaOk returns a tuple with the TotalDiskQuota field value
// and a boolean to check if the value has been set.
// NOTE: If the value is an explicit nil, `nil, true` will be returned
func (o *UpdateOrganizationRegionQuota) GetTotalDiskQuotaOk() (*float32, bool) {
	if o == nil {
		return nil, false
	}
	return o.TotalDiskQuota.Get(), o.TotalDiskQuota.IsSet()
}

// SetTotalDiskQuota sets field value
func (o *UpdateOrganizationRegionQuota) SetTotalDiskQuota(v float32) {
	o.TotalDiskQuota.Set(&v)
}

// GetMaxCpuPerSandbox returns the MaxCpuPerSandbox field value if set, zero value otherwise (both if not set or set to explicit null).
func (o *UpdateOrganizationRegionQuota) GetMaxCpuPerSandbox() float32 {
	if o == nil || IsNil(o.MaxCpuPerSandbox.Get()) {
		var ret float32
		return ret
	}
	return *o.MaxCpuPerSandbox.Get()
}

// GetMaxCpuPerSandboxOk returns a tuple with the MaxCpuPerSandbox field value if set, nil otherwise
// and a boolean to check if the value has been set.
// NOTE: If the value is an explicit nil, `nil, true` will be returned
func (o *UpdateOrganizationRegionQuota) GetMaxCpuPerSandboxOk() (*float32, bool) {
	if o == nil {
		return nil, false
	}
	return o.MaxCpuPerSandbox.Get(), o.MaxCpuPerSandbox.IsSet()
}

// HasMaxCpuPerSandbox returns a boolean if a field has been set.
func (o *UpdateOrganizationRegionQuota) HasMaxCpuPerSandbox() bool {
	if o != nil && o.MaxCpuPerSandbox.IsSet() {
		return true
	}

	return false
}

// SetMaxCpuPerSandbox gets a reference to the given NullableFloat32 and assigns it to the MaxCpuPerSandbox field.
func (o *UpdateOrganizationRegionQuota) SetMaxCpuPerSandbox(v float32) {
	o.MaxCpuPerSandbox.Set(&v)
}
// SetMaxCpuPerSandboxNil sets the value for MaxCpuPerSandbox to be an explicit nil
func (o *UpdateOrganizationRegionQuota) SetMaxCpuPerSandboxNil() {
	o.MaxCpuPerSandbox.Set(nil)
}

// UnsetMaxCpuPerSandbox ensures that no value is present for MaxCpuPerSandbox, not even an explicit nil
func (o *UpdateOrganizationRegionQuota) UnsetMaxCpuPerSandbox() {
	o.MaxCpuPerSandbox.Unset()
}

// GetMaxMemoryPerSandbox returns the MaxMemoryPerSandbox field value if set, zero value otherwise (both if not set or set to explicit null).
func (o *UpdateOrganizationRegionQuota) GetMaxMemoryPerSandbox() float32 {
	if o == nil || IsNil(o.MaxMemoryPerSandbox.Get()) {
		var ret float32
		return ret
	}
	return *o.MaxMemoryPerSandbox.Get()
}

// GetMaxMemoryPerSandboxOk returns a tuple with the MaxMemoryPerSandbox field value if set, nil otherwise
// and a boolean to check if the value has been set.
// NOTE: If the value is an explicit nil, `nil, true` will be returned
func (o *UpdateOrganizationRegionQuota) GetMaxMemoryPerSandboxOk() (*float32, bool) {
	if o == nil {
		return nil, false
	}
	return o.MaxMemoryPerSandbox.Get(), o.MaxMemoryPerSandbox.IsSet()
}

// HasMaxMemoryPerSandbox returns a boolean if a field has been set.
func (o *UpdateOrganizationRegionQuota) HasMaxMemoryPerSandbox() bool {
	if o != nil && o.MaxMemoryPerSandbox.IsSet() {
		return true
	}

	return false
}

// SetMaxMemoryPerSandbox gets a reference to the given NullableFloat32 and assigns it to the MaxMemoryPerSandbox field.
func (o *UpdateOrganizationRegionQuota) SetMaxMemoryPerSandbox(v float32) {
	o.MaxMemoryPerSandbox.Set(&v)
}
// SetMaxMemoryPerSandboxNil sets the value for MaxMemoryPerSandbox to be an explicit nil
func (o *UpdateOrganizationRegionQuota) SetMaxMemoryPerSandboxNil() {
	o.MaxMemoryPerSandbox.Set(nil)
}

// UnsetMaxMemoryPerSandbox ensures that no value is present for MaxMemoryPerSandbox, not even an explicit nil
func (o *UpdateOrganizationRegionQuota) UnsetMaxMemoryPerSandbox() {
	o.MaxMemoryPerSandbox.Unset()
}

// GetMaxDiskPerSandbox returns the MaxDiskPerSandbox field value if set, zero value otherwise (both if not set or set to explicit null).
func (o *UpdateOrganizationRegionQuota) GetMaxDiskPerSandbox() float32 {
	if o == nil || IsNil(o.MaxDiskPerSandbox.Get()) {
		var ret float32
		return ret
	}
	return *o.MaxDiskPerSandbox.Get()
}

// GetMaxDiskPerSandboxOk returns a tuple with the MaxDiskPerSandbox field value if set, nil otherwise
// and a boolean to check if the value has been set.
// NOTE: If the value is an explicit nil, `nil, true` will be returned
func (o *UpdateOrganizationRegionQuota) GetMaxDiskPerSandboxOk() (*float32, bool) {
	if o == nil {
		return nil, false
	}
	return o.MaxDiskPerSandbox.Get(), o.MaxDiskPerSandbox.IsSet()
}

// HasMaxDiskPerSandbox returns a boolean if a field has been set.
func (o *UpdateOrganizationRegionQuota) HasMaxDiskPerSandbox() bool {
	if o != nil && o.MaxDiskPerSandbox.IsSet() {
		return true
	}

	return false
}

// SetMaxDiskPerSandbox gets a reference to the given NullableFloat32 and assigns it to the MaxDiskPerSandbox field.
func (o *UpdateOrganizationRegionQuota) SetMaxDiskPerSandbox(v float32) {
	o.MaxDiskPerSandbox.Set(&v)
}
// SetMaxDiskPerSandboxNil sets the value for MaxDiskPerSandbox to be an explicit nil
func (o *UpdateOrganizationRegionQuota) SetMaxDiskPerSandboxNil() {
	o.MaxDiskPerSandbox.Set(nil)
}

// UnsetMaxDiskPerSandbox ensures that no value is present for MaxDiskPerSandbox, not even an explicit nil
func (o *UpdateOrganizationRegionQuota) UnsetMaxDiskPerSandbox() {
	o.MaxDiskPerSandbox.Unset()
}

// GetMaxDiskPerNonEphemeralSandbox returns the MaxDiskPerNonEphemeralSandbox field value if set, zero value otherwise (both if not set or set to explicit null).
func (o *UpdateOrganizationRegionQuota) GetMaxDiskPerNonEphemeralSandbox() float32 {
	if o == nil || IsNil(o.MaxDiskPerNonEphemeralSandbox.Get()) {
		var ret float32
		return ret
	}
	return *o.MaxDiskPerNonEphemeralSandbox.Get()
}

// GetMaxDiskPerNonEphemeralSandboxOk returns a tuple with the MaxDiskPerNonEphemeralSandbox field value if set, nil otherwise
// and a boolean to check if the value has been set.
// NOTE: If the value is an explicit nil, `nil, true` will be returned
func (o *UpdateOrganizationRegionQuota) GetMaxDiskPerNonEphemeralSandboxOk() (*float32, bool) {
	if o == nil {
		return nil, false
	}
	return o.MaxDiskPerNonEphemeralSandbox.Get(), o.MaxDiskPerNonEphemeralSandbox.IsSet()
}

// HasMaxDiskPerNonEphemeralSandbox returns a boolean if a field has been set.
func (o *UpdateOrganizationRegionQuota) HasMaxDiskPerNonEphemeralSandbox() bool {
	if o != nil && o.MaxDiskPerNonEphemeralSandbox.IsSet() {
		return true
	}

	return false
}

// SetMaxDiskPerNonEphemeralSandbox gets a reference to the given NullableFloat32 and assigns it to the MaxDiskPerNonEphemeralSandbox field.
func (o *UpdateOrganizationRegionQuota) SetMaxDiskPerNonEphemeralSandbox(v float32) {
	o.MaxDiskPerNonEphemeralSandbox.Set(&v)
}
// SetMaxDiskPerNonEphemeralSandboxNil sets the value for MaxDiskPerNonEphemeralSandbox to be an explicit nil
func (o *UpdateOrganizationRegionQuota) SetMaxDiskPerNonEphemeralSandboxNil() {
	o.MaxDiskPerNonEphemeralSandbox.Set(nil)
}

// UnsetMaxDiskPerNonEphemeralSandbox ensures that no value is present for MaxDiskPerNonEphemeralSandbox, not even an explicit nil
func (o *UpdateOrganizationRegionQuota) UnsetMaxDiskPerNonEphemeralSandbox() {
	o.MaxDiskPerNonEphemeralSandbox.Unset()
}

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

func (o UpdateOrganizationRegionQuota) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	toSerialize["totalCpuQuota"] = o.TotalCpuQuota.Get()
	toSerialize["totalMemoryQuota"] = o.TotalMemoryQuota.Get()
	toSerialize["totalDiskQuota"] = o.TotalDiskQuota.Get()
	if o.MaxCpuPerSandbox.IsSet() {
		toSerialize["maxCpuPerSandbox"] = o.MaxCpuPerSandbox.Get()
	}
	if o.MaxMemoryPerSandbox.IsSet() {
		toSerialize["maxMemoryPerSandbox"] = o.MaxMemoryPerSandbox.Get()
	}
	if o.MaxDiskPerSandbox.IsSet() {
		toSerialize["maxDiskPerSandbox"] = o.MaxDiskPerSandbox.Get()
	}
	if o.MaxDiskPerNonEphemeralSandbox.IsSet() {
		toSerialize["maxDiskPerNonEphemeralSandbox"] = o.MaxDiskPerNonEphemeralSandbox.Get()
	}

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

	return toSerialize, nil
}

func (o *UpdateOrganizationRegionQuota) 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{
		"totalCpuQuota",
		"totalMemoryQuota",
		"totalDiskQuota",
	}

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

	varUpdateOrganizationRegionQuota := _UpdateOrganizationRegionQuota{}

	err = json.Unmarshal(data, &varUpdateOrganizationRegionQuota)

	if err != nil {
		return err
	}

	*o = UpdateOrganizationRegionQuota(varUpdateOrganizationRegionQuota)

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

	if err = json.Unmarshal(data, &additionalProperties); err == nil {
		delete(additionalProperties, "totalCpuQuota")
		delete(additionalProperties, "totalMemoryQuota")
		delete(additionalProperties, "totalDiskQuota")
		delete(additionalProperties, "maxCpuPerSandbox")
		delete(additionalProperties, "maxMemoryPerSandbox")
		delete(additionalProperties, "maxDiskPerSandbox")
		delete(additionalProperties, "maxDiskPerNonEphemeralSandbox")
		o.AdditionalProperties = additionalProperties
	}

	return err
}

type NullableUpdateOrganizationRegionQuota struct {
	value *UpdateOrganizationRegionQuota
	isSet bool
}

func (v NullableUpdateOrganizationRegionQuota) Get() *UpdateOrganizationRegionQuota {
	return v.value
}

func (v *NullableUpdateOrganizationRegionQuota) Set(val *UpdateOrganizationRegionQuota) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableUpdateOrganizationRegionQuota(val *UpdateOrganizationRegionQuota) *NullableUpdateOrganizationRegionQuota {
	return &NullableUpdateOrganizationRegionQuota{value: val, isSet: true}
}

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

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


