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

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

// DeploymentV1Internal struct for DeploymentV1Internal
type DeploymentV1Internal struct {
	Created time.Time `json:"created"`
	Name string `json:"name"`
	ArtifactName string `json:"artifact_name"`
	Id string `json:"id"`
	Finished *time.Time `json:"finished,omitempty"`
	Status string `json:"status"`
	DeviceCount *int32 `json:"device_count,omitempty"`
	// An array of artifact's identifiers.
	Artifacts []string `json:"artifacts,omitempty"`
	Type *string `json:"type,omitempty"`
	AdditionalProperties map[string]interface{}
}

type _DeploymentV1Internal DeploymentV1Internal

// NewDeploymentV1Internal instantiates a new DeploymentV1Internal 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 NewDeploymentV1Internal(created time.Time, name string, artifactName string, id string, status string) *DeploymentV1Internal {
	this := DeploymentV1Internal{}
	this.Created = created
	this.Name = name
	this.ArtifactName = artifactName
	this.Id = id
	this.Status = status
	return &this
}

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

// GetCreated returns the Created field value
func (o *DeploymentV1Internal) GetCreated() time.Time {
	if o == nil {
		var ret time.Time
		return ret
	}

	return o.Created
}

// GetCreatedOk returns a tuple with the Created field value
// and a boolean to check if the value has been set.
func (o *DeploymentV1Internal) GetCreatedOk() (*time.Time, bool) {
	if o == nil {
		return nil, false
	}
	return &o.Created, true
}

// SetCreated sets field value
func (o *DeploymentV1Internal) SetCreated(v time.Time) {
	o.Created = v
}

// GetName returns the Name field value
func (o *DeploymentV1Internal) 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 *DeploymentV1Internal) GetNameOk() (*string, bool) {
	if o == nil {
		return nil, false
	}
	return &o.Name, true
}

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

// GetArtifactName returns the ArtifactName field value
func (o *DeploymentV1Internal) 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 *DeploymentV1Internal) GetArtifactNameOk() (*string, bool) {
	if o == nil {
		return nil, false
	}
	return &o.ArtifactName, true
}

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

// GetId returns the Id field value
func (o *DeploymentV1Internal) 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 *DeploymentV1Internal) GetIdOk() (*string, bool) {
	if o == nil {
		return nil, false
	}
	return &o.Id, true
}

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

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

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

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

	return false
}

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

// GetStatus returns the Status field value
func (o *DeploymentV1Internal) GetStatus() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.Status
}

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

// SetStatus sets field value
func (o *DeploymentV1Internal) SetStatus(v string) {
	o.Status = v
}

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

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

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

	return false
}

// SetDeviceCount gets a reference to the given int32 and assigns it to the DeviceCount field.
func (o *DeploymentV1Internal) SetDeviceCount(v int32) {
	o.DeviceCount = &v
}

// GetArtifacts returns the Artifacts field value if set, zero value otherwise.
func (o *DeploymentV1Internal) GetArtifacts() []string {
	if o == nil || IsNil(o.Artifacts) {
		var ret []string
		return ret
	}
	return o.Artifacts
}

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

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

	return false
}

// SetArtifacts gets a reference to the given []string and assigns it to the Artifacts field.
func (o *DeploymentV1Internal) SetArtifacts(v []string) {
	o.Artifacts = v
}

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

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

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

	return false
}

// SetType gets a reference to the given string and assigns it to the Type field.
func (o *DeploymentV1Internal) SetType(v string) {
	o.Type = &v
}

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

func (o DeploymentV1Internal) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	toSerialize["created"] = o.Created
	toSerialize["name"] = o.Name
	toSerialize["artifact_name"] = o.ArtifactName
	toSerialize["id"] = o.Id
	if !IsNil(o.Finished) {
		toSerialize["finished"] = o.Finished
	}
	toSerialize["status"] = o.Status
	if !IsNil(o.DeviceCount) {
		toSerialize["device_count"] = o.DeviceCount
	}
	if !IsNil(o.Artifacts) {
		toSerialize["artifacts"] = o.Artifacts
	}
	if !IsNil(o.Type) {
		toSerialize["type"] = o.Type
	}

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

	return toSerialize, nil
}

func (o *DeploymentV1Internal) 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{
		"created",
		"name",
		"artifact_name",
		"id",
		"status",
	}

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

	varDeploymentV1Internal := _DeploymentV1Internal{}

	err = json.Unmarshal(data, &varDeploymentV1Internal)

	if err != nil {
		return err
	}

	*o = DeploymentV1Internal(varDeploymentV1Internal)

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

	if err = json.Unmarshal(data, &additionalProperties); err == nil {
		delete(additionalProperties, "created")
		delete(additionalProperties, "name")
		delete(additionalProperties, "artifact_name")
		delete(additionalProperties, "id")
		delete(additionalProperties, "finished")
		delete(additionalProperties, "status")
		delete(additionalProperties, "device_count")
		delete(additionalProperties, "artifacts")
		delete(additionalProperties, "type")
		o.AdditionalProperties = additionalProperties
	}

	return err
}

type NullableDeploymentV1Internal struct {
	value *DeploymentV1Internal
	isSet bool
}

func (v NullableDeploymentV1Internal) Get() *DeploymentV1Internal {
	return v.value
}

func (v *NullableDeploymentV1Internal) Set(val *DeploymentV1Internal) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableDeploymentV1Internal(val *DeploymentV1Internal) *NullableDeploymentV1Internal {
	return &NullableDeploymentV1Internal{value: val, isSet: true}
}

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

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


