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

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

// NewDeploymentForGroup struct for NewDeploymentForGroup
type NewDeploymentForGroup struct {
	// Name of the deployment
	Name string `json:"name"`
	// Name of the artifact to deploy
	ArtifactName string `json:"artifact_name"`
	// Force the installation of the Artifact disabling the `already-installed` check.
	ForceInstallation *bool `json:"force_installation,omitempty"`
	AdditionalProperties map[string]interface{}
}

type _NewDeploymentForGroup NewDeploymentForGroup

// NewNewDeploymentForGroup instantiates a new NewDeploymentForGroup 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 NewNewDeploymentForGroup(name string, artifactName string) *NewDeploymentForGroup {
	this := NewDeploymentForGroup{}
	this.Name = name
	this.ArtifactName = artifactName
	return &this
}

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

// GetName returns the Name field value
func (o *NewDeploymentForGroup) GetName() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.Name
}

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

// SetName sets field value
func (o *NewDeploymentForGroup) SetName(v string) {
	o.Name = v
}

// GetArtifactName returns the ArtifactName field value
func (o *NewDeploymentForGroup) GetArtifactName() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.ArtifactName
}

// GetArtifactNameOk returns a tuple with the ArtifactName field value
// and a boolean to check if the value has been set.
func (o *NewDeploymentForGroup) GetArtifactNameOk() (*string, bool) {
	if o == nil {
		return nil, false
	}
	return &o.ArtifactName, true
}

// SetArtifactName sets field value
func (o *NewDeploymentForGroup) SetArtifactName(v string) {
	o.ArtifactName = v
}

// GetForceInstallation returns the ForceInstallation field value if set, zero value otherwise.
func (o *NewDeploymentForGroup) GetForceInstallation() bool {
	if o == nil || IsNil(o.ForceInstallation) {
		var ret bool
		return ret
	}
	return *o.ForceInstallation
}

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

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

	return false
}

// SetForceInstallation gets a reference to the given bool and assigns it to the ForceInstallation field.
func (o *NewDeploymentForGroup) SetForceInstallation(v bool) {
	o.ForceInstallation = &v
}

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

func (o NewDeploymentForGroup) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	toSerialize["name"] = o.Name
	toSerialize["artifact_name"] = o.ArtifactName
	if !IsNil(o.ForceInstallation) {
		toSerialize["force_installation"] = o.ForceInstallation
	}

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

	return toSerialize, nil
}

func (o *NewDeploymentForGroup) UnmarshalJSON(data []byte) (err error) {
	// This validates that all required properties are included in the JSON object
	// by unmarshalling the object into a generic map with string keys and checking
	// that every required field exists as a key in the generic map.
	requiredProperties := []string{
		"name",
		"artifact_name",
	}

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

	err = json.Unmarshal(data, &allProperties)

	if err != nil {
		return err;
	}

	for _, requiredProperty := range(requiredProperties) {
		if _, exists := allProperties[requiredProperty]; !exists {
			return fmt.Errorf("no value given for required property %v", requiredProperty)
		}
	}

	varNewDeploymentForGroup := _NewDeploymentForGroup{}

	err = json.Unmarshal(data, &varNewDeploymentForGroup)

	if err != nil {
		return err
	}

	*o = NewDeploymentForGroup(varNewDeploymentForGroup)

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

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

	return err
}

type NullableNewDeploymentForGroup struct {
	value *NewDeploymentForGroup
	isSet bool
}

func (v NullableNewDeploymentForGroup) Get() *NewDeploymentForGroup {
	return v.value
}

func (v *NullableNewDeploymentForGroup) Set(val *NewDeploymentForGroup) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableNewDeploymentForGroup(val *NewDeploymentForGroup) *NullableNewDeploymentForGroup {
	return &NullableNewDeploymentForGroup{value: val, isSet: true}
}

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

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


