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

// RegionQuota struct for RegionQuota
type RegionQuota struct {
	OrganizationId string `json:"organizationId"`
	RegionId string `json:"regionId"`
	TotalCpuQuota float32 `json:"totalCpuQuota"`
	TotalMemoryQuota float32 `json:"totalMemoryQuota"`
	TotalDiskQuota float32 `json:"totalDiskQuota"`
	MaxCpuPerSandbox NullableFloat32 `json:"maxCpuPerSandbox"`
	MaxMemoryPerSandbox NullableFloat32 `json:"maxMemoryPerSandbox"`
	MaxDiskPerSandbox NullableFloat32 `json:"maxDiskPerSandbox"`
	MaxDiskPerNonEphemeralSandbox NullableFloat32 `json:"maxDiskPerNonEphemeralSandbox"`
	AdditionalProperties map[string]interface{}
}

type _RegionQuota RegionQuota

// NewRegionQuota instantiates a new RegionQuota 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 NewRegionQuota(organizationId string, regionId string, totalCpuQuota float32, totalMemoryQuota float32, totalDiskQuota float32, maxCpuPerSandbox NullableFloat32, maxMemoryPerSandbox NullableFloat32, maxDiskPerSandbox NullableFloat32, maxDiskPerNonEphemeralSandbox NullableFloat32) *RegionQuota {
	this := RegionQuota{}
	this.OrganizationId = organizationId
	this.RegionId = regionId
	this.TotalCpuQuota = totalCpuQuota
	this.TotalMemoryQuota = totalMemoryQuota
	this.TotalDiskQuota = totalDiskQuota
	this.MaxCpuPerSandbox = maxCpuPerSandbox
	this.MaxMemoryPerSandbox = maxMemoryPerSandbox
	this.MaxDiskPerSandbox = maxDiskPerSandbox
	this.MaxDiskPerNonEphemeralSandbox = maxDiskPerNonEphemeralSandbox
	return &this
}

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

// GetOrganizationId returns the OrganizationId field value
func (o *RegionQuota) 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 *RegionQuota) GetOrganizationIdOk() (*string, bool) {
	if o == nil {
		return nil, false
	}
	return &o.OrganizationId, true
}

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

// GetRegionId returns the RegionId field value
func (o *RegionQuota) GetRegionId() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.RegionId
}

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

// SetRegionId sets field value
func (o *RegionQuota) SetRegionId(v string) {
	o.RegionId = v
}

// GetTotalCpuQuota returns the TotalCpuQuota field value
func (o *RegionQuota) GetTotalCpuQuota() float32 {
	if o == nil {
		var ret float32
		return ret
	}

	return o.TotalCpuQuota
}

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

// SetTotalCpuQuota sets field value
func (o *RegionQuota) SetTotalCpuQuota(v float32) {
	o.TotalCpuQuota = v
}

// GetTotalMemoryQuota returns the TotalMemoryQuota field value
func (o *RegionQuota) GetTotalMemoryQuota() float32 {
	if o == nil {
		var ret float32
		return ret
	}

	return o.TotalMemoryQuota
}

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

// SetTotalMemoryQuota sets field value
func (o *RegionQuota) SetTotalMemoryQuota(v float32) {
	o.TotalMemoryQuota = v
}

// GetTotalDiskQuota returns the TotalDiskQuota field value
func (o *RegionQuota) GetTotalDiskQuota() float32 {
	if o == nil {
		var ret float32
		return ret
	}

	return o.TotalDiskQuota
}

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

// SetTotalDiskQuota sets field value
func (o *RegionQuota) SetTotalDiskQuota(v float32) {
	o.TotalDiskQuota = v
}

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

	return *o.MaxCpuPerSandbox.Get()
}

// GetMaxCpuPerSandboxOk returns a tuple with the MaxCpuPerSandbox 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 *RegionQuota) GetMaxCpuPerSandboxOk() (*float32, bool) {
	if o == nil {
		return nil, false
	}
	return o.MaxCpuPerSandbox.Get(), o.MaxCpuPerSandbox.IsSet()
}

// SetMaxCpuPerSandbox sets field value
func (o *RegionQuota) SetMaxCpuPerSandbox(v float32) {
	o.MaxCpuPerSandbox.Set(&v)
}

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

	return *o.MaxMemoryPerSandbox.Get()
}

// GetMaxMemoryPerSandboxOk returns a tuple with the MaxMemoryPerSandbox 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 *RegionQuota) GetMaxMemoryPerSandboxOk() (*float32, bool) {
	if o == nil {
		return nil, false
	}
	return o.MaxMemoryPerSandbox.Get(), o.MaxMemoryPerSandbox.IsSet()
}

// SetMaxMemoryPerSandbox sets field value
func (o *RegionQuota) SetMaxMemoryPerSandbox(v float32) {
	o.MaxMemoryPerSandbox.Set(&v)
}

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

	return *o.MaxDiskPerSandbox.Get()
}

// GetMaxDiskPerSandboxOk returns a tuple with the MaxDiskPerSandbox 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 *RegionQuota) GetMaxDiskPerSandboxOk() (*float32, bool) {
	if o == nil {
		return nil, false
	}
	return o.MaxDiskPerSandbox.Get(), o.MaxDiskPerSandbox.IsSet()
}

// SetMaxDiskPerSandbox sets field value
func (o *RegionQuota) SetMaxDiskPerSandbox(v float32) {
	o.MaxDiskPerSandbox.Set(&v)
}

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

	return *o.MaxDiskPerNonEphemeralSandbox.Get()
}

// GetMaxDiskPerNonEphemeralSandboxOk returns a tuple with the MaxDiskPerNonEphemeralSandbox 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 *RegionQuota) GetMaxDiskPerNonEphemeralSandboxOk() (*float32, bool) {
	if o == nil {
		return nil, false
	}
	return o.MaxDiskPerNonEphemeralSandbox.Get(), o.MaxDiskPerNonEphemeralSandbox.IsSet()
}

// SetMaxDiskPerNonEphemeralSandbox sets field value
func (o *RegionQuota) SetMaxDiskPerNonEphemeralSandbox(v float32) {
	o.MaxDiskPerNonEphemeralSandbox.Set(&v)
}

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

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

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

	return toSerialize, nil
}

func (o *RegionQuota) 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{
		"organizationId",
		"regionId",
		"totalCpuQuota",
		"totalMemoryQuota",
		"totalDiskQuota",
		"maxCpuPerSandbox",
		"maxMemoryPerSandbox",
		"maxDiskPerSandbox",
		"maxDiskPerNonEphemeralSandbox",
	}

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

	varRegionQuota := _RegionQuota{}

	err = json.Unmarshal(data, &varRegionQuota)

	if err != nil {
		return err
	}

	*o = RegionQuota(varRegionQuota)

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

	if err = json.Unmarshal(data, &additionalProperties); err == nil {
		delete(additionalProperties, "organizationId")
		delete(additionalProperties, "regionId")
		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 NullableRegionQuota struct {
	value *RegionQuota
	isSet bool
}

func (v NullableRegionQuota) Get() *RegionQuota {
	return v.value
}

func (v *NullableRegionQuota) Set(val *RegionQuota) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableRegionQuota(val *RegionQuota) *NullableRegionQuota {
	return &NullableRegionQuota{value: val, isSet: true}
}

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

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


