/*
Daytona Toolbox API

Daytona Toolbox API

API version: v0.0.0-dev
*/

// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.

package toolbox

import (
	"encoding/json"
	"bytes"
	"fmt"
)

// checks if the ExecuteResponse type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &ExecuteResponse{}

// ExecuteResponse struct for ExecuteResponse
type ExecuteResponse struct {
	ExitCode *int32 `json:"exitCode,omitempty"`
	Result string `json:"result"`
}

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(result string) *ExecuteResponse {
	this := ExecuteResponse{}
	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 if set, zero value otherwise.
func (o *ExecuteResponse) GetExitCode() int32 {
	if o == nil || IsNil(o.ExitCode) {
		var ret int32
		return ret
	}
	return *o.ExitCode
}

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

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

	return false
}

// SetExitCode gets a reference to the given int32 and assigns it to the ExitCode field.
func (o *ExecuteResponse) SetExitCode(v int32) {
	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{}{}
	if !IsNil(o.ExitCode) {
		toSerialize["exitCode"] = o.ExitCode
	}
	toSerialize["result"] = o.Result
	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{
		"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{}

	decoder := json.NewDecoder(bytes.NewReader(data))
	decoder.DisallowUnknownFields()
	err = decoder.Decode(&varExecuteResponse)

	if err != nil {
		return err
	}

	*o = ExecuteResponse(varExecuteResponse)

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


