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

// DeploymentInstructions struct for DeploymentInstructions
type DeploymentInstructions struct {
	// Deployment ID
	Id string `json:"id"`
	Artifact DeploymentInstructionsArtifact `json:"artifact"`
	AdditionalProperties map[string]interface{}
}

type _DeploymentInstructions DeploymentInstructions

// NewDeploymentInstructions instantiates a new DeploymentInstructions 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 NewDeploymentInstructions(id string, artifact DeploymentInstructionsArtifact) *DeploymentInstructions {
	this := DeploymentInstructions{}
	this.Id = id
	this.Artifact = artifact
	return &this
}

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

// GetId returns the Id field value
func (o *DeploymentInstructions) GetId() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.Id
}

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

// SetId sets field value
func (o *DeploymentInstructions) SetId(v string) {
	o.Id = v
}

// GetArtifact returns the Artifact field value
func (o *DeploymentInstructions) GetArtifact() DeploymentInstructionsArtifact {
	if o == nil {
		var ret DeploymentInstructionsArtifact
		return ret
	}

	return o.Artifact
}

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

// SetArtifact sets field value
func (o *DeploymentInstructions) SetArtifact(v DeploymentInstructionsArtifact) {
	o.Artifact = v
}

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

func (o DeploymentInstructions) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	toSerialize["id"] = o.Id
	toSerialize["artifact"] = o.Artifact

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

	return toSerialize, nil
}

func (o *DeploymentInstructions) 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{
		"id",
		"artifact",
	}

	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)
		}
	}

	varDeploymentInstructions := _DeploymentInstructions{}

	err = json.Unmarshal(data, &varDeploymentInstructions)

	if err != nil {
		return err
	}

	*o = DeploymentInstructions(varDeploymentInstructions)

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

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

	return err
}

type NullableDeploymentInstructions struct {
	value *DeploymentInstructions
	isSet bool
}

func (v NullableDeploymentInstructions) Get() *DeploymentInstructions {
	return v.value
}

func (v *NullableDeploymentInstructions) Set(val *DeploymentInstructions) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableDeploymentInstructions(val *DeploymentInstructions) *NullableDeploymentInstructions {
	return &NullableDeploymentInstructions{value: val, isSet: true}
}

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

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


