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

// ExecuteResponse struct for ExecuteResponse
type ExecuteResponse struct {
	// Exit code
	ExitCode float32 `json:"exitCode"`
	// Command output
	Result string `json:"result"`
	AdditionalProperties map[string]interface{}
}

type _ExecuteResponse ExecuteResponse

// NewExecuteResponse instantiates a new ExecuteResponse 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 NewExecuteResponse(exitCode float32, result string) *ExecuteResponse {
	this := ExecuteResponse{}
	this.ExitCode = exitCode
	this.Result = result
	return &this
}

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

// GetExitCode returns the ExitCode field value
func (o *ExecuteResponse) GetExitCode() float32 {
	if o == nil {
		var ret float32
		return ret
	}

	return o.ExitCode
}

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

// SetExitCode sets field value
func (o *ExecuteResponse) SetExitCode(v float32) {
	o.ExitCode = v
}

// GetResult returns the Result field value
func (o *ExecuteResponse) GetResult() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.Result
}

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

// SetResult sets field value
func (o *ExecuteResponse) SetResult(v string) {
	o.Result = v
}

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

func (o ExecuteResponse) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	toSerialize["exitCode"] = o.ExitCode
	toSerialize["result"] = o.Result

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

	return toSerialize, nil
}

func (o *ExecuteResponse) 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{
		"exitCode",
		"result",
	}

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

	varExecuteResponse := _ExecuteResponse{}

	err = json.Unmarshal(data, &varExecuteResponse)

	if err != nil {
		return err
	}

	*o = ExecuteResponse(varExecuteResponse)

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

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

	return err
}

type NullableExecuteResponse struct {
	value *ExecuteResponse
	isSet bool
}

func (v NullableExecuteResponse) Get() *ExecuteResponse {
	return v.value
}

func (v *NullableExecuteResponse) Set(val *ExecuteResponse) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableExecuteResponse(val *ExecuteResponse) *NullableExecuteResponse {
	return &NullableExecuteResponse{value: val, isSet: true}
}

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

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


