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

// RunnerSnapshotDto struct for RunnerSnapshotDto
type RunnerSnapshotDto struct {
	// Runner snapshot ID
	RunnerSnapshotId string `json:"runnerSnapshotId"`
	// Runner ID
	RunnerId string `json:"runnerId"`
	// Runner domain
	RunnerDomain *string `json:"runnerDomain,omitempty"`
	AdditionalProperties map[string]interface{}
}

type _RunnerSnapshotDto RunnerSnapshotDto

// NewRunnerSnapshotDto instantiates a new RunnerSnapshotDto 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 NewRunnerSnapshotDto(runnerSnapshotId string, runnerId string) *RunnerSnapshotDto {
	this := RunnerSnapshotDto{}
	this.RunnerSnapshotId = runnerSnapshotId
	this.RunnerId = runnerId
	return &this
}

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

// GetRunnerSnapshotId returns the RunnerSnapshotId field value
func (o *RunnerSnapshotDto) GetRunnerSnapshotId() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.RunnerSnapshotId
}

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

// SetRunnerSnapshotId sets field value
func (o *RunnerSnapshotDto) SetRunnerSnapshotId(v string) {
	o.RunnerSnapshotId = v
}

// GetRunnerId returns the RunnerId field value
func (o *RunnerSnapshotDto) GetRunnerId() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.RunnerId
}

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

// SetRunnerId sets field value
func (o *RunnerSnapshotDto) SetRunnerId(v string) {
	o.RunnerId = v
}

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

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

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

	return false
}

// SetRunnerDomain gets a reference to the given string and assigns it to the RunnerDomain field.
func (o *RunnerSnapshotDto) SetRunnerDomain(v string) {
	o.RunnerDomain = &v
}

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

func (o RunnerSnapshotDto) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	toSerialize["runnerSnapshotId"] = o.RunnerSnapshotId
	toSerialize["runnerId"] = o.RunnerId
	if !IsNil(o.RunnerDomain) {
		toSerialize["runnerDomain"] = o.RunnerDomain
	}

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

	return toSerialize, nil
}

func (o *RunnerSnapshotDto) 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{
		"runnerSnapshotId",
		"runnerId",
	}

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

	varRunnerSnapshotDto := _RunnerSnapshotDto{}

	err = json.Unmarshal(data, &varRunnerSnapshotDto)

	if err != nil {
		return err
	}

	*o = RunnerSnapshotDto(varRunnerSnapshotDto)

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

	if err = json.Unmarshal(data, &additionalProperties); err == nil {
		delete(additionalProperties, "runnerSnapshotId")
		delete(additionalProperties, "runnerId")
		delete(additionalProperties, "runnerDomain")
		o.AdditionalProperties = additionalProperties
	}

	return err
}

type NullableRunnerSnapshotDto struct {
	value *RunnerSnapshotDto
	isSet bool
}

func (v NullableRunnerSnapshotDto) Get() *RunnerSnapshotDto {
	return v.value
}

func (v *NullableRunnerSnapshotDto) Set(val *RunnerSnapshotDto) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableRunnerSnapshotDto(val *RunnerSnapshotDto) *NullableRunnerSnapshotDto {
	return &NullableRunnerSnapshotDto{value: val, isSet: true}
}

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

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


