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

// DirectUploadMetadata Artifact metadata
type DirectUploadMetadata struct {
	// wsize of the artifact file. 
	Size *int32 `json:"size,omitempty"`
	// List of updates for this artifact.
	Updates []Update `json:"updates,omitempty"`
	AdditionalProperties map[string]interface{}
}

type _DirectUploadMetadata DirectUploadMetadata

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

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

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

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

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

	return false
}

// SetSize gets a reference to the given int32 and assigns it to the Size field.
func (o *DirectUploadMetadata) SetSize(v int32) {
	o.Size = &v
}

// GetUpdates returns the Updates field value if set, zero value otherwise.
func (o *DirectUploadMetadata) GetUpdates() []Update {
	if o == nil || IsNil(o.Updates) {
		var ret []Update
		return ret
	}
	return o.Updates
}

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

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

	return false
}

// SetUpdates gets a reference to the given []Update and assigns it to the Updates field.
func (o *DirectUploadMetadata) SetUpdates(v []Update) {
	o.Updates = v
}

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

func (o DirectUploadMetadata) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	if !IsNil(o.Size) {
		toSerialize["size"] = o.Size
	}
	if !IsNil(o.Updates) {
		toSerialize["updates"] = o.Updates
	}

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

	return toSerialize, nil
}

func (o *DirectUploadMetadata) UnmarshalJSON(data []byte) (err error) {
	varDirectUploadMetadata := _DirectUploadMetadata{}

	err = json.Unmarshal(data, &varDirectUploadMetadata)

	if err != nil {
		return err
	}

	*o = DirectUploadMetadata(varDirectUploadMetadata)

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

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

	return err
}

type NullableDirectUploadMetadata struct {
	value *DirectUploadMetadata
	isSet bool
}

func (v NullableDirectUploadMetadata) Get() *DirectUploadMetadata {
	return v.value
}

func (v *NullableDirectUploadMetadata) Set(val *DirectUploadMetadata) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableDirectUploadMetadata(val *DirectUploadMetadata) *NullableDirectUploadMetadata {
	return &NullableDirectUploadMetadata{value: val, isSet: true}
}

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

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


