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

// ExecuteRequest struct for ExecuteRequest
type ExecuteRequest struct {
	Command string `json:"command"`
	// Current working directory
	Cwd *string `json:"cwd,omitempty"`
	// Environment variables to set for the command
	Envs *map[string]string `json:"envs,omitempty"`
	// Timeout in seconds, defaults to 10 seconds
	Timeout *int32 `json:"timeout,omitempty"`
}

type _ExecuteRequest ExecuteRequest

// NewExecuteRequest instantiates a new ExecuteRequest 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 NewExecuteRequest(command string) *ExecuteRequest {
	this := ExecuteRequest{}
	this.Command = command
	return &this
}

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

// GetCommand returns the Command field value
func (o *ExecuteRequest) GetCommand() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.Command
}

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

// SetCommand sets field value
func (o *ExecuteRequest) SetCommand(v string) {
	o.Command = v
}

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

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

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

	return false
}

// SetCwd gets a reference to the given string and assigns it to the Cwd field.
func (o *ExecuteRequest) SetCwd(v string) {
	o.Cwd = &v
}

// GetEnvs returns the Envs field value if set, zero value otherwise.
func (o *ExecuteRequest) GetEnvs() map[string]string {
	if o == nil || IsNil(o.Envs) {
		var ret map[string]string
		return ret
	}
	return *o.Envs
}

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

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

	return false
}

// SetEnvs gets a reference to the given map[string]string and assigns it to the Envs field.
func (o *ExecuteRequest) SetEnvs(v map[string]string) {
	o.Envs = &v
}

// GetTimeout returns the Timeout field value if set, zero value otherwise.
func (o *ExecuteRequest) GetTimeout() int32 {
	if o == nil || IsNil(o.Timeout) {
		var ret int32
		return ret
	}
	return *o.Timeout
}

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

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

	return false
}

// SetTimeout gets a reference to the given int32 and assigns it to the Timeout field.
func (o *ExecuteRequest) SetTimeout(v int32) {
	o.Timeout = &v
}

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

func (o ExecuteRequest) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	toSerialize["command"] = o.Command
	if !IsNil(o.Cwd) {
		toSerialize["cwd"] = o.Cwd
	}
	if !IsNil(o.Envs) {
		toSerialize["envs"] = o.Envs
	}
	if !IsNil(o.Timeout) {
		toSerialize["timeout"] = o.Timeout
	}
	return toSerialize, nil
}

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

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

	varExecuteRequest := _ExecuteRequest{}

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

	if err != nil {
		return err
	}

	*o = ExecuteRequest(varExecuteRequest)

	return err
}

type NullableExecuteRequest struct {
	value *ExecuteRequest
	isSet bool
}

func (v NullableExecuteRequest) Get() *ExecuteRequest {
	return v.value
}

func (v *NullableExecuteRequest) Set(val *ExecuteRequest) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableExecuteRequest(val *ExecuteRequest) *NullableExecuteRequest {
	return &NullableExecuteRequest{value: val, isSet: true}
}

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

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


