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

// RunnerHealthMetrics struct for RunnerHealthMetrics
type RunnerHealthMetrics struct {
	// Current CPU load average
	CurrentCpuLoadAverage float32 `json:"currentCpuLoadAverage"`
	// Current CPU usage percentage
	CurrentCpuUsagePercentage float32 `json:"currentCpuUsagePercentage"`
	// Current memory usage percentage
	CurrentMemoryUsagePercentage float32 `json:"currentMemoryUsagePercentage"`
	// Current disk usage percentage
	CurrentDiskUsagePercentage float32 `json:"currentDiskUsagePercentage"`
	// Currently allocated CPU cores
	CurrentAllocatedCpu float32 `json:"currentAllocatedCpu"`
	// Currently allocated memory in GiB
	CurrentAllocatedMemoryGiB float32 `json:"currentAllocatedMemoryGiB"`
	// Currently allocated disk in GiB
	CurrentAllocatedDiskGiB float32 `json:"currentAllocatedDiskGiB"`
	// Number of snapshots currently stored
	CurrentSnapshotCount float32 `json:"currentSnapshotCount"`
	// Number of started sandboxes
	CurrentStartedSandboxes float32 `json:"currentStartedSandboxes"`
	// Total CPU cores on the runner
	Cpu float32 `json:"cpu"`
	// Total RAM in GiB on the runner
	MemoryGiB float32 `json:"memoryGiB"`
	// Total disk space in GiB on the runner
	DiskGiB float32 `json:"diskGiB"`
	AdditionalProperties map[string]interface{}
}

type _RunnerHealthMetrics RunnerHealthMetrics

// NewRunnerHealthMetrics instantiates a new RunnerHealthMetrics 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 NewRunnerHealthMetrics(currentCpuLoadAverage float32, currentCpuUsagePercentage float32, currentMemoryUsagePercentage float32, currentDiskUsagePercentage float32, currentAllocatedCpu float32, currentAllocatedMemoryGiB float32, currentAllocatedDiskGiB float32, currentSnapshotCount float32, currentStartedSandboxes float32, cpu float32, memoryGiB float32, diskGiB float32) *RunnerHealthMetrics {
	this := RunnerHealthMetrics{}
	this.CurrentCpuLoadAverage = currentCpuLoadAverage
	this.CurrentCpuUsagePercentage = currentCpuUsagePercentage
	this.CurrentMemoryUsagePercentage = currentMemoryUsagePercentage
	this.CurrentDiskUsagePercentage = currentDiskUsagePercentage
	this.CurrentAllocatedCpu = currentAllocatedCpu
	this.CurrentAllocatedMemoryGiB = currentAllocatedMemoryGiB
	this.CurrentAllocatedDiskGiB = currentAllocatedDiskGiB
	this.CurrentSnapshotCount = currentSnapshotCount
	this.CurrentStartedSandboxes = currentStartedSandboxes
	this.Cpu = cpu
	this.MemoryGiB = memoryGiB
	this.DiskGiB = diskGiB
	return &this
}

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

// GetCurrentCpuLoadAverage returns the CurrentCpuLoadAverage field value
func (o *RunnerHealthMetrics) GetCurrentCpuLoadAverage() float32 {
	if o == nil {
		var ret float32
		return ret
	}

	return o.CurrentCpuLoadAverage
}

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

// SetCurrentCpuLoadAverage sets field value
func (o *RunnerHealthMetrics) SetCurrentCpuLoadAverage(v float32) {
	o.CurrentCpuLoadAverage = v
}

// GetCurrentCpuUsagePercentage returns the CurrentCpuUsagePercentage field value
func (o *RunnerHealthMetrics) GetCurrentCpuUsagePercentage() float32 {
	if o == nil {
		var ret float32
		return ret
	}

	return o.CurrentCpuUsagePercentage
}

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

// SetCurrentCpuUsagePercentage sets field value
func (o *RunnerHealthMetrics) SetCurrentCpuUsagePercentage(v float32) {
	o.CurrentCpuUsagePercentage = v
}

// GetCurrentMemoryUsagePercentage returns the CurrentMemoryUsagePercentage field value
func (o *RunnerHealthMetrics) GetCurrentMemoryUsagePercentage() float32 {
	if o == nil {
		var ret float32
		return ret
	}

	return o.CurrentMemoryUsagePercentage
}

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

// SetCurrentMemoryUsagePercentage sets field value
func (o *RunnerHealthMetrics) SetCurrentMemoryUsagePercentage(v float32) {
	o.CurrentMemoryUsagePercentage = v
}

// GetCurrentDiskUsagePercentage returns the CurrentDiskUsagePercentage field value
func (o *RunnerHealthMetrics) GetCurrentDiskUsagePercentage() float32 {
	if o == nil {
		var ret float32
		return ret
	}

	return o.CurrentDiskUsagePercentage
}

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

// SetCurrentDiskUsagePercentage sets field value
func (o *RunnerHealthMetrics) SetCurrentDiskUsagePercentage(v float32) {
	o.CurrentDiskUsagePercentage = v
}

// GetCurrentAllocatedCpu returns the CurrentAllocatedCpu field value
func (o *RunnerHealthMetrics) GetCurrentAllocatedCpu() float32 {
	if o == nil {
		var ret float32
		return ret
	}

	return o.CurrentAllocatedCpu
}

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

// SetCurrentAllocatedCpu sets field value
func (o *RunnerHealthMetrics) SetCurrentAllocatedCpu(v float32) {
	o.CurrentAllocatedCpu = v
}

// GetCurrentAllocatedMemoryGiB returns the CurrentAllocatedMemoryGiB field value
func (o *RunnerHealthMetrics) GetCurrentAllocatedMemoryGiB() float32 {
	if o == nil {
		var ret float32
		return ret
	}

	return o.CurrentAllocatedMemoryGiB
}

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

// SetCurrentAllocatedMemoryGiB sets field value
func (o *RunnerHealthMetrics) SetCurrentAllocatedMemoryGiB(v float32) {
	o.CurrentAllocatedMemoryGiB = v
}

// GetCurrentAllocatedDiskGiB returns the CurrentAllocatedDiskGiB field value
func (o *RunnerHealthMetrics) GetCurrentAllocatedDiskGiB() float32 {
	if o == nil {
		var ret float32
		return ret
	}

	return o.CurrentAllocatedDiskGiB
}

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

// SetCurrentAllocatedDiskGiB sets field value
func (o *RunnerHealthMetrics) SetCurrentAllocatedDiskGiB(v float32) {
	o.CurrentAllocatedDiskGiB = v
}

// GetCurrentSnapshotCount returns the CurrentSnapshotCount field value
func (o *RunnerHealthMetrics) GetCurrentSnapshotCount() float32 {
	if o == nil {
		var ret float32
		return ret
	}

	return o.CurrentSnapshotCount
}

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

// SetCurrentSnapshotCount sets field value
func (o *RunnerHealthMetrics) SetCurrentSnapshotCount(v float32) {
	o.CurrentSnapshotCount = v
}

// GetCurrentStartedSandboxes returns the CurrentStartedSandboxes field value
func (o *RunnerHealthMetrics) GetCurrentStartedSandboxes() float32 {
	if o == nil {
		var ret float32
		return ret
	}

	return o.CurrentStartedSandboxes
}

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

// SetCurrentStartedSandboxes sets field value
func (o *RunnerHealthMetrics) SetCurrentStartedSandboxes(v float32) {
	o.CurrentStartedSandboxes = v
}

// GetCpu returns the Cpu field value
func (o *RunnerHealthMetrics) GetCpu() float32 {
	if o == nil {
		var ret float32
		return ret
	}

	return o.Cpu
}

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

// SetCpu sets field value
func (o *RunnerHealthMetrics) SetCpu(v float32) {
	o.Cpu = v
}

// GetMemoryGiB returns the MemoryGiB field value
func (o *RunnerHealthMetrics) GetMemoryGiB() float32 {
	if o == nil {
		var ret float32
		return ret
	}

	return o.MemoryGiB
}

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

// SetMemoryGiB sets field value
func (o *RunnerHealthMetrics) SetMemoryGiB(v float32) {
	o.MemoryGiB = v
}

// GetDiskGiB returns the DiskGiB field value
func (o *RunnerHealthMetrics) GetDiskGiB() float32 {
	if o == nil {
		var ret float32
		return ret
	}

	return o.DiskGiB
}

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

// SetDiskGiB sets field value
func (o *RunnerHealthMetrics) SetDiskGiB(v float32) {
	o.DiskGiB = v
}

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

func (o RunnerHealthMetrics) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	toSerialize["currentCpuLoadAverage"] = o.CurrentCpuLoadAverage
	toSerialize["currentCpuUsagePercentage"] = o.CurrentCpuUsagePercentage
	toSerialize["currentMemoryUsagePercentage"] = o.CurrentMemoryUsagePercentage
	toSerialize["currentDiskUsagePercentage"] = o.CurrentDiskUsagePercentage
	toSerialize["currentAllocatedCpu"] = o.CurrentAllocatedCpu
	toSerialize["currentAllocatedMemoryGiB"] = o.CurrentAllocatedMemoryGiB
	toSerialize["currentAllocatedDiskGiB"] = o.CurrentAllocatedDiskGiB
	toSerialize["currentSnapshotCount"] = o.CurrentSnapshotCount
	toSerialize["currentStartedSandboxes"] = o.CurrentStartedSandboxes
	toSerialize["cpu"] = o.Cpu
	toSerialize["memoryGiB"] = o.MemoryGiB
	toSerialize["diskGiB"] = o.DiskGiB

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

	return toSerialize, nil
}

func (o *RunnerHealthMetrics) 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{
		"currentCpuLoadAverage",
		"currentCpuUsagePercentage",
		"currentMemoryUsagePercentage",
		"currentDiskUsagePercentage",
		"currentAllocatedCpu",
		"currentAllocatedMemoryGiB",
		"currentAllocatedDiskGiB",
		"currentSnapshotCount",
		"currentStartedSandboxes",
		"cpu",
		"memoryGiB",
		"diskGiB",
	}

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

	varRunnerHealthMetrics := _RunnerHealthMetrics{}

	err = json.Unmarshal(data, &varRunnerHealthMetrics)

	if err != nil {
		return err
	}

	*o = RunnerHealthMetrics(varRunnerHealthMetrics)

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

	if err = json.Unmarshal(data, &additionalProperties); err == nil {
		delete(additionalProperties, "currentCpuLoadAverage")
		delete(additionalProperties, "currentCpuUsagePercentage")
		delete(additionalProperties, "currentMemoryUsagePercentage")
		delete(additionalProperties, "currentDiskUsagePercentage")
		delete(additionalProperties, "currentAllocatedCpu")
		delete(additionalProperties, "currentAllocatedMemoryGiB")
		delete(additionalProperties, "currentAllocatedDiskGiB")
		delete(additionalProperties, "currentSnapshotCount")
		delete(additionalProperties, "currentStartedSandboxes")
		delete(additionalProperties, "cpu")
		delete(additionalProperties, "memoryGiB")
		delete(additionalProperties, "diskGiB")
		o.AdditionalProperties = additionalProperties
	}

	return err
}

type NullableRunnerHealthMetrics struct {
	value *RunnerHealthMetrics
	isSet bool
}

func (v NullableRunnerHealthMetrics) Get() *RunnerHealthMetrics {
	return v.value
}

func (v *NullableRunnerHealthMetrics) Set(val *RunnerHealthMetrics) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableRunnerHealthMetrics(val *RunnerHealthMetrics) *NullableRunnerHealthMetrics {
	return &NullableRunnerHealthMetrics{value: val, isSet: true}
}

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

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


