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

// DeploymentStatistics struct for DeploymentStatistics
type DeploymentStatistics struct {
	Status *Statistics `json:"status,omitempty"`
	// Sum of sizes (in bytes) of all artifacts assigned to all device deployments, which are part of this deployment. If the same artifact is assigned to multiple device deployments, its size will be counted multiple times. 
	TotalSize *int32 `json:"total_size,omitempty"`
	AdditionalProperties map[string]interface{}
}

type _DeploymentStatistics DeploymentStatistics

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

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

// GetStatus returns the Status field value if set, zero value otherwise.
func (o *DeploymentStatistics) GetStatus() Statistics {
	if o == nil || IsNil(o.Status) {
		var ret Statistics
		return ret
	}
	return *o.Status
}

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

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

	return false
}

// SetStatus gets a reference to the given Statistics and assigns it to the Status field.
func (o *DeploymentStatistics) SetStatus(v Statistics) {
	o.Status = &v
}

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

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

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

	return false
}

// SetTotalSize gets a reference to the given int32 and assigns it to the TotalSize field.
func (o *DeploymentStatistics) SetTotalSize(v int32) {
	o.TotalSize = &v
}

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

func (o DeploymentStatistics) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	if !IsNil(o.Status) {
		toSerialize["status"] = o.Status
	}
	if !IsNil(o.TotalSize) {
		toSerialize["total_size"] = o.TotalSize
	}

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

	return toSerialize, nil
}

func (o *DeploymentStatistics) UnmarshalJSON(data []byte) (err error) {
	varDeploymentStatistics := _DeploymentStatistics{}

	err = json.Unmarshal(data, &varDeploymentStatistics)

	if err != nil {
		return err
	}

	*o = DeploymentStatistics(varDeploymentStatistics)

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

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

	return err
}

type NullableDeploymentStatistics struct {
	value *DeploymentStatistics
	isSet bool
}

func (v NullableDeploymentStatistics) Get() *DeploymentStatistics {
	return v.value
}

func (v *NullableDeploymentStatistics) Set(val *DeploymentStatistics) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableDeploymentStatistics(val *DeploymentStatistics) *NullableDeploymentStatistics {
	return &NullableDeploymentStatistics{value: val, isSet: true}
}

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

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


