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

// NewConfigurationDeployment struct for NewConfigurationDeployment
type NewConfigurationDeployment struct {
	// The number of times a device can retry the deployment in case of failure, defaults to 0
	Retries *int32 `json:"retries,omitempty"`
	// A valid JSON object defining the update control map. *NOTE*: Available only in the Enterprise plan. 
	UpdateControlMap map[string]interface{} `json:"update_control_map,omitempty"`
	AdditionalProperties map[string]interface{}
}

type _NewConfigurationDeployment NewConfigurationDeployment

// NewNewConfigurationDeployment instantiates a new NewConfigurationDeployment 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 NewNewConfigurationDeployment() *NewConfigurationDeployment {
	this := NewConfigurationDeployment{}
	var retries int32 = 0
	this.Retries = &retries
	return &this
}

// NewNewConfigurationDeploymentWithDefaults instantiates a new NewConfigurationDeployment 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 NewNewConfigurationDeploymentWithDefaults() *NewConfigurationDeployment {
	this := NewConfigurationDeployment{}
	var retries int32 = 0
	this.Retries = &retries
	return &this
}

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

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

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

	return false
}

// SetRetries gets a reference to the given int32 and assigns it to the Retries field.
func (o *NewConfigurationDeployment) SetRetries(v int32) {
	o.Retries = &v
}

// GetUpdateControlMap returns the UpdateControlMap field value if set, zero value otherwise.
func (o *NewConfigurationDeployment) GetUpdateControlMap() map[string]interface{} {
	if o == nil || IsNil(o.UpdateControlMap) {
		var ret map[string]interface{}
		return ret
	}
	return o.UpdateControlMap
}

// GetUpdateControlMapOk returns a tuple with the UpdateControlMap field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *NewConfigurationDeployment) GetUpdateControlMapOk() (map[string]interface{}, bool) {
	if o == nil || IsNil(o.UpdateControlMap) {
		return map[string]interface{}{}, false
	}
	return o.UpdateControlMap, true
}

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

	return false
}

// SetUpdateControlMap gets a reference to the given map[string]interface{} and assigns it to the UpdateControlMap field.
func (o *NewConfigurationDeployment) SetUpdateControlMap(v map[string]interface{}) {
	o.UpdateControlMap = v
}

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

func (o NewConfigurationDeployment) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	if !IsNil(o.Retries) {
		toSerialize["retries"] = o.Retries
	}
	if !IsNil(o.UpdateControlMap) {
		toSerialize["update_control_map"] = o.UpdateControlMap
	}

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

	return toSerialize, nil
}

func (o *NewConfigurationDeployment) UnmarshalJSON(data []byte) (err error) {
	varNewConfigurationDeployment := _NewConfigurationDeployment{}

	err = json.Unmarshal(data, &varNewConfigurationDeployment)

	if err != nil {
		return err
	}

	*o = NewConfigurationDeployment(varNewConfigurationDeployment)

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

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

	return err
}

type NullableNewConfigurationDeployment struct {
	value *NewConfigurationDeployment
	isSet bool
}

func (v NullableNewConfigurationDeployment) Get() *NewConfigurationDeployment {
	return v.value
}

func (v *NullableNewConfigurationDeployment) Set(val *NewConfigurationDeployment) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableNewConfigurationDeployment(val *NewConfigurationDeployment) *NullableNewConfigurationDeployment {
	return &NullableNewConfigurationDeployment{value: val, isSet: true}
}

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

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


