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

// SessionExecuteResponse struct for SessionExecuteResponse
type SessionExecuteResponse struct {
	CmdId string `json:"cmdId"`
	ExitCode *int32 `json:"exitCode,omitempty"`
	Output *string `json:"output,omitempty"`
	Stderr *string `json:"stderr,omitempty"`
	Stdout *string `json:"stdout,omitempty"`
}

type _SessionExecuteResponse SessionExecuteResponse

// NewSessionExecuteResponse instantiates a new SessionExecuteResponse 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 NewSessionExecuteResponse(cmdId string) *SessionExecuteResponse {
	this := SessionExecuteResponse{}
	this.CmdId = cmdId
	return &this
}

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

// GetCmdId returns the CmdId field value
func (o *SessionExecuteResponse) GetCmdId() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.CmdId
}

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

// SetCmdId sets field value
func (o *SessionExecuteResponse) SetCmdId(v string) {
	o.CmdId = v
}

// GetExitCode returns the ExitCode field value if set, zero value otherwise.
func (o *SessionExecuteResponse) 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 *SessionExecuteResponse) 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 *SessionExecuteResponse) 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 *SessionExecuteResponse) SetExitCode(v int32) {
	o.ExitCode = &v
}

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

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

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

	return false
}

// SetOutput gets a reference to the given string and assigns it to the Output field.
func (o *SessionExecuteResponse) SetOutput(v string) {
	o.Output = &v
}

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

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

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

	return false
}

// SetStderr gets a reference to the given string and assigns it to the Stderr field.
func (o *SessionExecuteResponse) SetStderr(v string) {
	o.Stderr = &v
}

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

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

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

	return false
}

// SetStdout gets a reference to the given string and assigns it to the Stdout field.
func (o *SessionExecuteResponse) SetStdout(v string) {
	o.Stdout = &v
}

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

func (o SessionExecuteResponse) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	toSerialize["cmdId"] = o.CmdId
	if !IsNil(o.ExitCode) {
		toSerialize["exitCode"] = o.ExitCode
	}
	if !IsNil(o.Output) {
		toSerialize["output"] = o.Output
	}
	if !IsNil(o.Stderr) {
		toSerialize["stderr"] = o.Stderr
	}
	if !IsNil(o.Stdout) {
		toSerialize["stdout"] = o.Stdout
	}
	return toSerialize, nil
}

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

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

	varSessionExecuteResponse := _SessionExecuteResponse{}

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

	if err != nil {
		return err
	}

	*o = SessionExecuteResponse(varSessionExecuteResponse)

	return err
}

type NullableSessionExecuteResponse struct {
	value *SessionExecuteResponse
	isSet bool
}

func (v NullableSessionExecuteResponse) Get() *SessionExecuteResponse {
	return v.value
}

func (v *NullableSessionExecuteResponse) Set(val *SessionExecuteResponse) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableSessionExecuteResponse(val *SessionExecuteResponse) *NullableSessionExecuteResponse {
	return &NullableSessionExecuteResponse{value: val, isSet: true}
}

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

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


