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

// LastDeviceDeployment struct for LastDeviceDeployment
type LastDeviceDeployment struct {
	DeviceId *string `json:"device_id,omitempty"`
	DeploymentId *string `json:"deployment_id,omitempty"`
	DeviceDeploymentId *string `json:"device_deployment_id,omitempty"`
	DeviceDeploymentStatus *string `json:"device_deployment_status,omitempty"`
	AdditionalProperties map[string]interface{}
}

type _LastDeviceDeployment LastDeviceDeployment

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

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

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

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

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

	return false
}

// SetDeviceId gets a reference to the given string and assigns it to the DeviceId field.
func (o *LastDeviceDeployment) SetDeviceId(v string) {
	o.DeviceId = &v
}

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

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

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

	return false
}

// SetDeploymentId gets a reference to the given string and assigns it to the DeploymentId field.
func (o *LastDeviceDeployment) SetDeploymentId(v string) {
	o.DeploymentId = &v
}

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

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

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

	return false
}

// SetDeviceDeploymentId gets a reference to the given string and assigns it to the DeviceDeploymentId field.
func (o *LastDeviceDeployment) SetDeviceDeploymentId(v string) {
	o.DeviceDeploymentId = &v
}

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

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

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

	return false
}

// SetDeviceDeploymentStatus gets a reference to the given string and assigns it to the DeviceDeploymentStatus field.
func (o *LastDeviceDeployment) SetDeviceDeploymentStatus(v string) {
	o.DeviceDeploymentStatus = &v
}

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

func (o LastDeviceDeployment) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	if !IsNil(o.DeviceId) {
		toSerialize["device_id"] = o.DeviceId
	}
	if !IsNil(o.DeploymentId) {
		toSerialize["deployment_id"] = o.DeploymentId
	}
	if !IsNil(o.DeviceDeploymentId) {
		toSerialize["device_deployment_id"] = o.DeviceDeploymentId
	}
	if !IsNil(o.DeviceDeploymentStatus) {
		toSerialize["device_deployment_status"] = o.DeviceDeploymentStatus
	}

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

	return toSerialize, nil
}

func (o *LastDeviceDeployment) UnmarshalJSON(data []byte) (err error) {
	varLastDeviceDeployment := _LastDeviceDeployment{}

	err = json.Unmarshal(data, &varLastDeviceDeployment)

	if err != nil {
		return err
	}

	*o = LastDeviceDeployment(varLastDeviceDeployment)

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

	if err = json.Unmarshal(data, &additionalProperties); err == nil {
		delete(additionalProperties, "device_id")
		delete(additionalProperties, "deployment_id")
		delete(additionalProperties, "device_deployment_id")
		delete(additionalProperties, "device_deployment_status")
		o.AdditionalProperties = additionalProperties
	}

	return err
}

type NullableLastDeviceDeployment struct {
	value *LastDeviceDeployment
	isSet bool
}

func (v NullableLastDeviceDeployment) Get() *LastDeviceDeployment {
	return v.value
}

func (v *NullableLastDeviceDeployment) Set(val *LastDeviceDeployment) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableLastDeviceDeployment(val *LastDeviceDeployment) *NullableLastDeviceDeployment {
	return &NullableLastDeviceDeployment{value: val, isSet: true}
}

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

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


