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

// RegionUsageOverview struct for RegionUsageOverview
type RegionUsageOverview struct {
	RegionId string `json:"regionId"`
	TotalCpuQuota float32 `json:"totalCpuQuota"`
	CurrentCpuUsage float32 `json:"currentCpuUsage"`
	TotalMemoryQuota float32 `json:"totalMemoryQuota"`
	CurrentMemoryUsage float32 `json:"currentMemoryUsage"`
	TotalDiskQuota float32 `json:"totalDiskQuota"`
	CurrentDiskUsage float32 `json:"currentDiskUsage"`
	MaxCpuPerSandbox NullableFloat32 `json:"maxCpuPerSandbox"`
	MaxMemoryPerSandbox NullableFloat32 `json:"maxMemoryPerSandbox"`
	MaxDiskPerSandbox NullableFloat32 `json:"maxDiskPerSandbox"`
	MaxDiskPerNonEphemeralSandbox NullableFloat32 `json:"maxDiskPerNonEphemeralSandbox"`
	AdditionalProperties map[string]interface{}
}

type _RegionUsageOverview RegionUsageOverview

// NewRegionUsageOverview instantiates a new RegionUsageOverview 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 NewRegionUsageOverview(regionId string, totalCpuQuota float32, currentCpuUsage float32, totalMemoryQuota float32, currentMemoryUsage float32, totalDiskQuota float32, currentDiskUsage float32, maxCpuPerSandbox NullableFloat32, maxMemoryPerSandbox NullableFloat32, maxDiskPerSandbox NullableFloat32, maxDiskPerNonEphemeralSandbox NullableFloat32) *RegionUsageOverview {
	this := RegionUsageOverview{}
	this.RegionId = regionId
	this.TotalCpuQuota = totalCpuQuota
	this.CurrentCpuUsage = currentCpuUsage
	this.TotalMemoryQuota = totalMemoryQuota
	this.CurrentMemoryUsage = currentMemoryUsage
	this.TotalDiskQuota = totalDiskQuota
	this.CurrentDiskUsage = currentDiskUsage
	this.MaxCpuPerSandbox = maxCpuPerSandbox
	this.MaxMemoryPerSandbox = maxMemoryPerSandbox
	this.MaxDiskPerSandbox = maxDiskPerSandbox
	this.MaxDiskPerNonEphemeralSandbox = maxDiskPerNonEphemeralSandbox
	return &this
}

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

// GetRegionId returns the RegionId field value
func (o *RegionUsageOverview) 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 *RegionUsageOverview) GetRegionIdOk() (*string, bool) {
	if o == nil {
		return nil, false
	}
	return &o.RegionId, true
}

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

// GetTotalCpuQuota returns the TotalCpuQuota field value
func (o *RegionUsageOverview) 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 *RegionUsageOverview) GetTotalCpuQuotaOk() (*float32, bool) {
	if o == nil {
		return nil, false
	}
	return &o.TotalCpuQuota, true
}

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

// GetCurrentCpuUsage returns the CurrentCpuUsage field value
func (o *RegionUsageOverview) GetCurrentCpuUsage() float32 {
	if o == nil {
		var ret float32
		return ret
	}

	return o.CurrentCpuUsage
}

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

// SetCurrentCpuUsage sets field value
func (o *RegionUsageOverview) SetCurrentCpuUsage(v float32) {
	o.CurrentCpuUsage = v
}

// GetTotalMemoryQuota returns the TotalMemoryQuota field value
func (o *RegionUsageOverview) 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 *RegionUsageOverview) GetTotalMemoryQuotaOk() (*float32, bool) {
	if o == nil {
		return nil, false
	}
	return &o.TotalMemoryQuota, true
}

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

// GetCurrentMemoryUsage returns the CurrentMemoryUsage field value
func (o *RegionUsageOverview) GetCurrentMemoryUsage() float32 {
	if o == nil {
		var ret float32
		return ret
	}

	return o.CurrentMemoryUsage
}

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

// SetCurrentMemoryUsage sets field value
func (o *RegionUsageOverview) SetCurrentMemoryUsage(v float32) {
	o.CurrentMemoryUsage = v
}

// GetTotalDiskQuota returns the TotalDiskQuota field value
func (o *RegionUsageOverview) 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 *RegionUsageOverview) GetTotalDiskQuotaOk() (*float32, bool) {
	if o == nil {
		return nil, false
	}
	return &o.TotalDiskQuota, true
}

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

// GetCurrentDiskUsage returns the CurrentDiskUsage field value
func (o *RegionUsageOverview) GetCurrentDiskUsage() float32 {
	if o == nil {
		var ret float32
		return ret
	}

	return o.CurrentDiskUsage
}

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

// SetCurrentDiskUsage sets field value
func (o *RegionUsageOverview) SetCurrentDiskUsage(v float32) {
	o.CurrentDiskUsage = v
}

// GetMaxCpuPerSandbox returns the MaxCpuPerSandbox field value
// If the value is explicit nil, the zero value for float32 will be returned
func (o *RegionUsageOverview) 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 *RegionUsageOverview) GetMaxCpuPerSandboxOk() (*float32, bool) {
	if o == nil {
		return nil, false
	}
	return o.MaxCpuPerSandbox.Get(), o.MaxCpuPerSandbox.IsSet()
}

// SetMaxCpuPerSandbox sets field value
func (o *RegionUsageOverview) 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 *RegionUsageOverview) 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 *RegionUsageOverview) GetMaxMemoryPerSandboxOk() (*float32, bool) {
	if o == nil {
		return nil, false
	}
	return o.MaxMemoryPerSandbox.Get(), o.MaxMemoryPerSandbox.IsSet()
}

// SetMaxMemoryPerSandbox sets field value
func (o *RegionUsageOverview) 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 *RegionUsageOverview) 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 *RegionUsageOverview) GetMaxDiskPerSandboxOk() (*float32, bool) {
	if o == nil {
		return nil, false
	}
	return o.MaxDiskPerSandbox.Get(), o.MaxDiskPerSandbox.IsSet()
}

// SetMaxDiskPerSandbox sets field value
func (o *RegionUsageOverview) 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 *RegionUsageOverview) 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 *RegionUsageOverview) GetMaxDiskPerNonEphemeralSandboxOk() (*float32, bool) {
	if o == nil {
		return nil, false
	}
	return o.MaxDiskPerNonEphemeralSandbox.Get(), o.MaxDiskPerNonEphemeralSandbox.IsSet()
}

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

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

func (o RegionUsageOverview) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	toSerialize["regionId"] = o.RegionId
	toSerialize["totalCpuQuota"] = o.TotalCpuQuota
	toSerialize["currentCpuUsage"] = o.CurrentCpuUsage
	toSerialize["totalMemoryQuota"] = o.TotalMemoryQuota
	toSerialize["currentMemoryUsage"] = o.CurrentMemoryUsage
	toSerialize["totalDiskQuota"] = o.TotalDiskQuota
	toSerialize["currentDiskUsage"] = o.CurrentDiskUsage
	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 *RegionUsageOverview) 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{
		"regionId",
		"totalCpuQuota",
		"currentCpuUsage",
		"totalMemoryQuota",
		"currentMemoryUsage",
		"totalDiskQuota",
		"currentDiskUsage",
		"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)
		}
	}

	varRegionUsageOverview := _RegionUsageOverview{}

	err = json.Unmarshal(data, &varRegionUsageOverview)

	if err != nil {
		return err
	}

	*o = RegionUsageOverview(varRegionUsageOverview)

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

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

	return err
}

type NullableRegionUsageOverview struct {
	value *RegionUsageOverview
	isSet bool
}

func (v NullableRegionUsageOverview) Get() *RegionUsageOverview {
	return v.value
}

func (v *NullableRegionUsageOverview) Set(val *RegionUsageOverview) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableRegionUsageOverview(val *RegionUsageOverview) *NullableRegionUsageOverview {
	return &NullableRegionUsageOverview{value: val, isSet: true}
}

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

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


