/*
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"
	"time"
)

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

// UpdateFile Information about particular update file. 
type UpdateFile struct {
	Name *string `json:"name,omitempty"`
	Checksum *string `json:"checksum,omitempty"`
	Size *int32 `json:"size,omitempty"`
	Date *time.Time `json:"date,omitempty"`
	AdditionalProperties map[string]interface{}
}

type _UpdateFile UpdateFile

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

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

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

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

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

	return false
}

// SetName gets a reference to the given string and assigns it to the Name field.
func (o *UpdateFile) SetName(v string) {
	o.Name = &v
}

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

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

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

	return false
}

// SetChecksum gets a reference to the given string and assigns it to the Checksum field.
func (o *UpdateFile) SetChecksum(v string) {
	o.Checksum = &v
}

// GetSize returns the Size field value if set, zero value otherwise.
func (o *UpdateFile) 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 *UpdateFile) 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 *UpdateFile) 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 *UpdateFile) SetSize(v int32) {
	o.Size = &v
}

// GetDate returns the Date field value if set, zero value otherwise.
func (o *UpdateFile) GetDate() time.Time {
	if o == nil || IsNil(o.Date) {
		var ret time.Time
		return ret
	}
	return *o.Date
}

// GetDateOk returns a tuple with the Date field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *UpdateFile) GetDateOk() (*time.Time, bool) {
	if o == nil || IsNil(o.Date) {
		return nil, false
	}
	return o.Date, true
}

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

	return false
}

// SetDate gets a reference to the given time.Time and assigns it to the Date field.
func (o *UpdateFile) SetDate(v time.Time) {
	o.Date = &v
}

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

func (o UpdateFile) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	if !IsNil(o.Name) {
		toSerialize["name"] = o.Name
	}
	if !IsNil(o.Checksum) {
		toSerialize["checksum"] = o.Checksum
	}
	if !IsNil(o.Size) {
		toSerialize["size"] = o.Size
	}
	if !IsNil(o.Date) {
		toSerialize["date"] = o.Date
	}

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

	return toSerialize, nil
}

func (o *UpdateFile) UnmarshalJSON(data []byte) (err error) {
	varUpdateFile := _UpdateFile{}

	err = json.Unmarshal(data, &varUpdateFile)

	if err != nil {
		return err
	}

	*o = UpdateFile(varUpdateFile)

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

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

	return err
}

type NullableUpdateFile struct {
	value *UpdateFile
	isSet bool
}

func (v NullableUpdateFile) Get() *UpdateFile {
	return v.value
}

func (v *NullableUpdateFile) Set(val *UpdateFile) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableUpdateFile(val *UpdateFile) *NullableUpdateFile {
	return &NullableUpdateFile{value: val, isSet: true}
}

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

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


