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

// RunnerHealthcheck struct for RunnerHealthcheck
type RunnerHealthcheck struct {
	// Runner metrics
	Metrics *RunnerHealthMetrics `json:"metrics,omitempty"`
	// Health status of individual services on the runner
	ServiceHealth []RunnerServiceHealth `json:"serviceHealth,omitempty"`
	// Runner domain
	Domain *string `json:"domain,omitempty"`
	// Runner proxy URL
	ProxyUrl *string `json:"proxyUrl,omitempty"`
	// Runner API URL
	ApiUrl *string `json:"apiUrl,omitempty"`
	// Runner app version
	AppVersion string `json:"appVersion"`
	AdditionalProperties map[string]interface{}
}

type _RunnerHealthcheck RunnerHealthcheck

// NewRunnerHealthcheck instantiates a new RunnerHealthcheck 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 NewRunnerHealthcheck(appVersion string) *RunnerHealthcheck {
	this := RunnerHealthcheck{}
	this.AppVersion = appVersion
	return &this
}

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

// GetMetrics returns the Metrics field value if set, zero value otherwise.
func (o *RunnerHealthcheck) GetMetrics() RunnerHealthMetrics {
	if o == nil || IsNil(o.Metrics) {
		var ret RunnerHealthMetrics
		return ret
	}
	return *o.Metrics
}

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

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

	return false
}

// SetMetrics gets a reference to the given RunnerHealthMetrics and assigns it to the Metrics field.
func (o *RunnerHealthcheck) SetMetrics(v RunnerHealthMetrics) {
	o.Metrics = &v
}

// GetServiceHealth returns the ServiceHealth field value if set, zero value otherwise.
func (o *RunnerHealthcheck) GetServiceHealth() []RunnerServiceHealth {
	if o == nil || IsNil(o.ServiceHealth) {
		var ret []RunnerServiceHealth
		return ret
	}
	return o.ServiceHealth
}

// GetServiceHealthOk returns a tuple with the ServiceHealth field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *RunnerHealthcheck) GetServiceHealthOk() ([]RunnerServiceHealth, bool) {
	if o == nil || IsNil(o.ServiceHealth) {
		return nil, false
	}
	return o.ServiceHealth, true
}

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

	return false
}

// SetServiceHealth gets a reference to the given []RunnerServiceHealth and assigns it to the ServiceHealth field.
func (o *RunnerHealthcheck) SetServiceHealth(v []RunnerServiceHealth) {
	o.ServiceHealth = v
}

// GetDomain returns the Domain field value if set, zero value otherwise.
func (o *RunnerHealthcheck) 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 *RunnerHealthcheck) 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 *RunnerHealthcheck) 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 *RunnerHealthcheck) SetDomain(v string) {
	o.Domain = &v
}

// GetProxyUrl returns the ProxyUrl field value if set, zero value otherwise.
func (o *RunnerHealthcheck) 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 *RunnerHealthcheck) 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 *RunnerHealthcheck) 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 *RunnerHealthcheck) SetProxyUrl(v string) {
	o.ProxyUrl = &v
}

// GetApiUrl returns the ApiUrl field value if set, zero value otherwise.
func (o *RunnerHealthcheck) 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 *RunnerHealthcheck) 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 *RunnerHealthcheck) 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 *RunnerHealthcheck) SetApiUrl(v string) {
	o.ApiUrl = &v
}

// GetAppVersion returns the AppVersion field value
func (o *RunnerHealthcheck) GetAppVersion() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.AppVersion
}

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

// SetAppVersion sets field value
func (o *RunnerHealthcheck) SetAppVersion(v string) {
	o.AppVersion = v
}

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

func (o RunnerHealthcheck) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	if !IsNil(o.Metrics) {
		toSerialize["metrics"] = o.Metrics
	}
	if !IsNil(o.ServiceHealth) {
		toSerialize["serviceHealth"] = o.ServiceHealth
	}
	if !IsNil(o.Domain) {
		toSerialize["domain"] = o.Domain
	}
	if !IsNil(o.ProxyUrl) {
		toSerialize["proxyUrl"] = o.ProxyUrl
	}
	if !IsNil(o.ApiUrl) {
		toSerialize["apiUrl"] = o.ApiUrl
	}
	toSerialize["appVersion"] = o.AppVersion

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

	return toSerialize, nil
}

func (o *RunnerHealthcheck) 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{
		"appVersion",
	}

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

	varRunnerHealthcheck := _RunnerHealthcheck{}

	err = json.Unmarshal(data, &varRunnerHealthcheck)

	if err != nil {
		return err
	}

	*o = RunnerHealthcheck(varRunnerHealthcheck)

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

	if err = json.Unmarshal(data, &additionalProperties); err == nil {
		delete(additionalProperties, "metrics")
		delete(additionalProperties, "serviceHealth")
		delete(additionalProperties, "domain")
		delete(additionalProperties, "proxyUrl")
		delete(additionalProperties, "apiUrl")
		delete(additionalProperties, "appVersion")
		o.AdditionalProperties = additionalProperties
	}

	return err
}

type NullableRunnerHealthcheck struct {
	value *RunnerHealthcheck
	isSet bool
}

func (v NullableRunnerHealthcheck) Get() *RunnerHealthcheck {
	return v.value
}

func (v *NullableRunnerHealthcheck) Set(val *RunnerHealthcheck) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableRunnerHealthcheck(val *RunnerHealthcheck) *NullableRunnerHealthcheck {
	return &NullableRunnerHealthcheck{value: val, isSet: true}
}

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

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


