/*
Mender API

Combined API specification for the features of the different Mender backend services, suitable for code generation applications 

API version: 1
Contact: support@mender.io
*/

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

package client

import (
	"encoding/json"
)

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

// TaskResultCLI struct for TaskResultCLI
type TaskResultCLI struct {
	Command []string `json:"command,omitempty"`
	Output *string `json:"output,omitempty"`
	Error *string `json:"error,omitempty"`
	ExitCode *int32 `json:"exitCode,omitempty"`
	AdditionalProperties map[string]interface{}
}

type _TaskResultCLI TaskResultCLI

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

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

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

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

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

	return false
}

// SetCommand gets a reference to the given []string and assigns it to the Command field.
func (o *TaskResultCLI) SetCommand(v []string) {
	o.Command = v
}

// GetOutput returns the Output field value if set, zero value otherwise.
func (o *TaskResultCLI) 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 *TaskResultCLI) 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 *TaskResultCLI) 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 *TaskResultCLI) SetOutput(v string) {
	o.Output = &v
}

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

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

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

	return false
}

// SetError gets a reference to the given string and assigns it to the Error field.
func (o *TaskResultCLI) SetError(v string) {
	o.Error = &v
}

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

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

func (o TaskResultCLI) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	if !IsNil(o.Command) {
		toSerialize["command"] = o.Command
	}
	if !IsNil(o.Output) {
		toSerialize["output"] = o.Output
	}
	if !IsNil(o.Error) {
		toSerialize["error"] = o.Error
	}
	if !IsNil(o.ExitCode) {
		toSerialize["exitCode"] = o.ExitCode
	}

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

	return toSerialize, nil
}

func (o *TaskResultCLI) UnmarshalJSON(data []byte) (err error) {
	varTaskResultCLI := _TaskResultCLI{}

	err = json.Unmarshal(data, &varTaskResultCLI)

	if err != nil {
		return err
	}

	*o = TaskResultCLI(varTaskResultCLI)

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

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

	return err
}

type NullableTaskResultCLI struct {
	value *TaskResultCLI
	isSet bool
}

func (v NullableTaskResultCLI) Get() *TaskResultCLI {
	return v.value
}

func (v *NullableTaskResultCLI) Set(val *TaskResultCLI) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableTaskResultCLI(val *TaskResultCLI) *NullableTaskResultCLI {
	return &NullableTaskResultCLI{value: val, isSet: true}
}

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

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


