/*
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"
)

// checks if the ResizeSandbox type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &ResizeSandbox{}

// ResizeSandbox struct for ResizeSandbox
type ResizeSandbox struct {
	// CPU cores to allocate to the sandbox (minimum: 1)
	Cpu *int32 `json:"cpu,omitempty"`
	// Memory in GB to allocate to the sandbox (minimum: 1)
	Memory *int32 `json:"memory,omitempty"`
	// Disk space in GB to allocate to the sandbox (can only be increased)
	Disk *int32 `json:"disk,omitempty"`
	AdditionalProperties map[string]interface{}
}

type _ResizeSandbox ResizeSandbox

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

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

// GetCpu returns the Cpu field value if set, zero value otherwise.
func (o *ResizeSandbox) GetCpu() int32 {
	if o == nil || IsNil(o.Cpu) {
		var ret int32
		return ret
	}
	return *o.Cpu
}

// GetCpuOk returns a tuple with the Cpu field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *ResizeSandbox) GetCpuOk() (*int32, bool) {
	if o == nil || IsNil(o.Cpu) {
		return nil, false
	}
	return o.Cpu, true
}

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

	return false
}

// SetCpu gets a reference to the given int32 and assigns it to the Cpu field.
func (o *ResizeSandbox) SetCpu(v int32) {
	o.Cpu = &v
}

// GetMemory returns the Memory field value if set, zero value otherwise.
func (o *ResizeSandbox) GetMemory() int32 {
	if o == nil || IsNil(o.Memory) {
		var ret int32
		return ret
	}
	return *o.Memory
}

// GetMemoryOk returns a tuple with the Memory field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *ResizeSandbox) GetMemoryOk() (*int32, bool) {
	if o == nil || IsNil(o.Memory) {
		return nil, false
	}
	return o.Memory, true
}

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

	return false
}

// SetMemory gets a reference to the given int32 and assigns it to the Memory field.
func (o *ResizeSandbox) SetMemory(v int32) {
	o.Memory = &v
}

// GetDisk returns the Disk field value if set, zero value otherwise.
func (o *ResizeSandbox) GetDisk() int32 {
	if o == nil || IsNil(o.Disk) {
		var ret int32
		return ret
	}
	return *o.Disk
}

// GetDiskOk returns a tuple with the Disk field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *ResizeSandbox) GetDiskOk() (*int32, bool) {
	if o == nil || IsNil(o.Disk) {
		return nil, false
	}
	return o.Disk, true
}

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

	return false
}

// SetDisk gets a reference to the given int32 and assigns it to the Disk field.
func (o *ResizeSandbox) SetDisk(v int32) {
	o.Disk = &v
}

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

func (o ResizeSandbox) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	if !IsNil(o.Cpu) {
		toSerialize["cpu"] = o.Cpu
	}
	if !IsNil(o.Memory) {
		toSerialize["memory"] = o.Memory
	}
	if !IsNil(o.Disk) {
		toSerialize["disk"] = o.Disk
	}

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

	return toSerialize, nil
}

func (o *ResizeSandbox) UnmarshalJSON(data []byte) (err error) {
	varResizeSandbox := _ResizeSandbox{}

	err = json.Unmarshal(data, &varResizeSandbox)

	if err != nil {
		return err
	}

	*o = ResizeSandbox(varResizeSandbox)

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

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

	return err
}

type NullableResizeSandbox struct {
	value *ResizeSandbox
	isSet bool
}

func (v NullableResizeSandbox) Get() *ResizeSandbox {
	return v.value
}

func (v *NullableResizeSandbox) Set(val *ResizeSandbox) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableResizeSandbox(val *ResizeSandbox) *NullableResizeSandbox {
	return &NullableResizeSandbox{value: val, isSet: true}
}

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

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


