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

// AdminCreateRunner struct for AdminCreateRunner
type AdminCreateRunner struct {
	RegionId string `json:"regionId"`
	Name string `json:"name"`
	ApiKey string `json:"apiKey"`
	// The api version of the runner to create
	ApiVersion string `json:"apiVersion" validate:"regexp=^(0|2)$"`
	// The domain of the runner
	Domain *string `json:"domain,omitempty"`
	// The API URL of the runner
	ApiUrl *string `json:"apiUrl,omitempty"`
	// The proxy URL of the runner
	ProxyUrl *string `json:"proxyUrl,omitempty"`
	// The CPU capacity of the runner
	Cpu *float32 `json:"cpu,omitempty"`
	// The memory capacity of the runner in GiB
	MemoryGiB *float32 `json:"memoryGiB,omitempty"`
	// The disk capacity of the runner in GiB
	DiskGiB *float32 `json:"diskGiB,omitempty"`
	AdditionalProperties map[string]interface{}
}

type _AdminCreateRunner AdminCreateRunner

// NewAdminCreateRunner instantiates a new AdminCreateRunner 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 NewAdminCreateRunner(regionId string, name string, apiKey string, apiVersion string) *AdminCreateRunner {
	this := AdminCreateRunner{}
	this.RegionId = regionId
	this.Name = name
	this.ApiKey = apiKey
	this.ApiVersion = apiVersion
	return &this
}

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

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

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

// GetName returns the Name field value
func (o *AdminCreateRunner) GetName() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.Name
}

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

// SetName sets field value
func (o *AdminCreateRunner) SetName(v string) {
	o.Name = v
}

// GetApiKey returns the ApiKey field value
func (o *AdminCreateRunner) GetApiKey() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.ApiKey
}

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

// SetApiKey sets field value
func (o *AdminCreateRunner) SetApiKey(v string) {
	o.ApiKey = v
}

// GetApiVersion returns the ApiVersion field value
func (o *AdminCreateRunner) GetApiVersion() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.ApiVersion
}

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

// SetApiVersion sets field value
func (o *AdminCreateRunner) SetApiVersion(v string) {
	o.ApiVersion = v
}

// GetDomain returns the Domain field value if set, zero value otherwise.
func (o *AdminCreateRunner) GetDomain() string {
	if o == nil || IsNil(o.Domain) {
		var ret string
		return ret
	}
	return *o.Domain
}

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

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

	return false
}

// SetDomain gets a reference to the given string and assigns it to the Domain field.
func (o *AdminCreateRunner) SetDomain(v string) {
	o.Domain = &v
}

// GetApiUrl returns the ApiUrl field value if set, zero value otherwise.
func (o *AdminCreateRunner) GetApiUrl() string {
	if o == nil || IsNil(o.ApiUrl) {
		var ret string
		return ret
	}
	return *o.ApiUrl
}

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

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

	return false
}

// SetApiUrl gets a reference to the given string and assigns it to the ApiUrl field.
func (o *AdminCreateRunner) SetApiUrl(v string) {
	o.ApiUrl = &v
}

// GetProxyUrl returns the ProxyUrl field value if set, zero value otherwise.
func (o *AdminCreateRunner) GetProxyUrl() string {
	if o == nil || IsNil(o.ProxyUrl) {
		var ret string
		return ret
	}
	return *o.ProxyUrl
}

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

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

	return false
}

// SetProxyUrl gets a reference to the given string and assigns it to the ProxyUrl field.
func (o *AdminCreateRunner) SetProxyUrl(v string) {
	o.ProxyUrl = &v
}

// GetCpu returns the Cpu field value if set, zero value otherwise.
func (o *AdminCreateRunner) GetCpu() float32 {
	if o == nil || IsNil(o.Cpu) {
		var ret float32
		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 *AdminCreateRunner) GetCpuOk() (*float32, 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 *AdminCreateRunner) HasCpu() bool {
	if o != nil && !IsNil(o.Cpu) {
		return true
	}

	return false
}

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

// GetMemoryGiB returns the MemoryGiB field value if set, zero value otherwise.
func (o *AdminCreateRunner) GetMemoryGiB() float32 {
	if o == nil || IsNil(o.MemoryGiB) {
		var ret float32
		return ret
	}
	return *o.MemoryGiB
}

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

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

	return false
}

// SetMemoryGiB gets a reference to the given float32 and assigns it to the MemoryGiB field.
func (o *AdminCreateRunner) SetMemoryGiB(v float32) {
	o.MemoryGiB = &v
}

// GetDiskGiB returns the DiskGiB field value if set, zero value otherwise.
func (o *AdminCreateRunner) GetDiskGiB() float32 {
	if o == nil || IsNil(o.DiskGiB) {
		var ret float32
		return ret
	}
	return *o.DiskGiB
}

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

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

	return false
}

// SetDiskGiB gets a reference to the given float32 and assigns it to the DiskGiB field.
func (o *AdminCreateRunner) SetDiskGiB(v float32) {
	o.DiskGiB = &v
}

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

func (o AdminCreateRunner) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	toSerialize["regionId"] = o.RegionId
	toSerialize["name"] = o.Name
	toSerialize["apiKey"] = o.ApiKey
	toSerialize["apiVersion"] = o.ApiVersion
	if !IsNil(o.Domain) {
		toSerialize["domain"] = o.Domain
	}
	if !IsNil(o.ApiUrl) {
		toSerialize["apiUrl"] = o.ApiUrl
	}
	if !IsNil(o.ProxyUrl) {
		toSerialize["proxyUrl"] = o.ProxyUrl
	}
	if !IsNil(o.Cpu) {
		toSerialize["cpu"] = o.Cpu
	}
	if !IsNil(o.MemoryGiB) {
		toSerialize["memoryGiB"] = o.MemoryGiB
	}
	if !IsNil(o.DiskGiB) {
		toSerialize["diskGiB"] = o.DiskGiB
	}

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

	return toSerialize, nil
}

func (o *AdminCreateRunner) 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",
		"name",
		"apiKey",
		"apiVersion",
	}

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

	varAdminCreateRunner := _AdminCreateRunner{}

	err = json.Unmarshal(data, &varAdminCreateRunner)

	if err != nil {
		return err
	}

	*o = AdminCreateRunner(varAdminCreateRunner)

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

	if err = json.Unmarshal(data, &additionalProperties); err == nil {
		delete(additionalProperties, "regionId")
		delete(additionalProperties, "name")
		delete(additionalProperties, "apiKey")
		delete(additionalProperties, "apiVersion")
		delete(additionalProperties, "domain")
		delete(additionalProperties, "apiUrl")
		delete(additionalProperties, "proxyUrl")
		delete(additionalProperties, "cpu")
		delete(additionalProperties, "memoryGiB")
		delete(additionalProperties, "diskGiB")
		o.AdditionalProperties = additionalProperties
	}

	return err
}

type NullableAdminCreateRunner struct {
	value *AdminCreateRunner
	isSet bool
}

func (v NullableAdminCreateRunner) Get() *AdminCreateRunner {
	return v.value
}

func (v *NullableAdminCreateRunner) Set(val *AdminCreateRunner) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableAdminCreateRunner(val *AdminCreateRunner) *NullableAdminCreateRunner {
	return &NullableAdminCreateRunner{value: val, isSet: true}
}

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

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


