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

// CreateRunnerResponse struct for CreateRunnerResponse
type CreateRunnerResponse struct {
	// The ID of the runner
	Id string `json:"id"`
	// The API key for the runner
	ApiKey string `json:"apiKey"`
	AdditionalProperties map[string]interface{}
}

type _CreateRunnerResponse CreateRunnerResponse

// NewCreateRunnerResponse instantiates a new CreateRunnerResponse 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 NewCreateRunnerResponse(id string, apiKey string) *CreateRunnerResponse {
	this := CreateRunnerResponse{}
	this.Id = id
	this.ApiKey = apiKey
	return &this
}

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

// GetId returns the Id field value
func (o *CreateRunnerResponse) GetId() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.Id
}

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

// SetId sets field value
func (o *CreateRunnerResponse) SetId(v string) {
	o.Id = v
}

// GetApiKey returns the ApiKey field value
func (o *CreateRunnerResponse) 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 *CreateRunnerResponse) GetApiKeyOk() (*string, bool) {
	if o == nil {
		return nil, false
	}
	return &o.ApiKey, true
}

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

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

func (o CreateRunnerResponse) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	toSerialize["id"] = o.Id
	toSerialize["apiKey"] = o.ApiKey

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

	return toSerialize, nil
}

func (o *CreateRunnerResponse) 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{
		"id",
		"apiKey",
	}

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

	varCreateRunnerResponse := _CreateRunnerResponse{}

	err = json.Unmarshal(data, &varCreateRunnerResponse)

	if err != nil {
		return err
	}

	*o = CreateRunnerResponse(varCreateRunnerResponse)

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

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

	return err
}

type NullableCreateRunnerResponse struct {
	value *CreateRunnerResponse
	isSet bool
}

func (v NullableCreateRunnerResponse) Get() *CreateRunnerResponse {
	return v.value
}

func (v *NullableCreateRunnerResponse) Set(val *CreateRunnerResponse) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableCreateRunnerResponse(val *CreateRunnerResponse) *NullableCreateRunnerResponse {
	return &NullableCreateRunnerResponse{value: val, isSet: true}
}

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

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


