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

// DeviceInventoryRequest struct for DeviceInventoryRequest
type DeviceInventoryRequest struct {
	// Mender-assigned unique ID.
	Id *string `json:"id,omitempty"`
	// Timestamp of the most recent attribute update.
	UpdatedTs *string `json:"updated_ts,omitempty"`
	// A list of attribute descriptors.
	Attributes []AttributeRequest `json:"attributes,omitempty"`
	AdditionalProperties map[string]interface{}
}

type _DeviceInventoryRequest DeviceInventoryRequest

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

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

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

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

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

	return false
}

// SetId gets a reference to the given string and assigns it to the Id field.
func (o *DeviceInventoryRequest) SetId(v string) {
	o.Id = &v
}

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

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

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

	return false
}

// SetUpdatedTs gets a reference to the given string and assigns it to the UpdatedTs field.
func (o *DeviceInventoryRequest) SetUpdatedTs(v string) {
	o.UpdatedTs = &v
}

// GetAttributes returns the Attributes field value if set, zero value otherwise.
func (o *DeviceInventoryRequest) GetAttributes() []AttributeRequest {
	if o == nil || IsNil(o.Attributes) {
		var ret []AttributeRequest
		return ret
	}
	return o.Attributes
}

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

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

	return false
}

// SetAttributes gets a reference to the given []AttributeRequest and assigns it to the Attributes field.
func (o *DeviceInventoryRequest) SetAttributes(v []AttributeRequest) {
	o.Attributes = v
}

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

func (o DeviceInventoryRequest) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	if !IsNil(o.Id) {
		toSerialize["id"] = o.Id
	}
	if !IsNil(o.UpdatedTs) {
		toSerialize["updated_ts"] = o.UpdatedTs
	}
	if !IsNil(o.Attributes) {
		toSerialize["attributes"] = o.Attributes
	}

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

	return toSerialize, nil
}

func (o *DeviceInventoryRequest) UnmarshalJSON(data []byte) (err error) {
	varDeviceInventoryRequest := _DeviceInventoryRequest{}

	err = json.Unmarshal(data, &varDeviceInventoryRequest)

	if err != nil {
		return err
	}

	*o = DeviceInventoryRequest(varDeviceInventoryRequest)

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

	if err = json.Unmarshal(data, &additionalProperties); err == nil {
		delete(additionalProperties, "id")
		delete(additionalProperties, "updated_ts")
		delete(additionalProperties, "attributes")
		o.AdditionalProperties = additionalProperties
	}

	return err
}

type NullableDeviceInventoryRequest struct {
	value *DeviceInventoryRequest
	isSet bool
}

func (v NullableDeviceInventoryRequest) Get() *DeviceInventoryRequest {
	return v.value
}

func (v *NullableDeviceInventoryRequest) Set(val *DeviceInventoryRequest) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableDeviceInventoryRequest(val *DeviceInventoryRequest) *NullableDeviceInventoryRequest {
	return &NullableDeviceInventoryRequest{value: val, isSet: true}
}

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

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


