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

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

// DeploymentInstructionsArtifactSource struct for DeploymentInstructionsArtifactSource
type DeploymentInstructionsArtifactSource struct {
	// URL to fetch the artifact from
	Uri *string `json:"uri,omitempty"`
	// URL expiration time
	Expire *time.Time `json:"expire,omitempty"`
	AdditionalProperties map[string]interface{}
}

type _DeploymentInstructionsArtifactSource DeploymentInstructionsArtifactSource

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

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

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

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

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

	return false
}

// SetUri gets a reference to the given string and assigns it to the Uri field.
func (o *DeploymentInstructionsArtifactSource) SetUri(v string) {
	o.Uri = &v
}

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

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

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

	return false
}

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

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

func (o DeploymentInstructionsArtifactSource) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	if !IsNil(o.Uri) {
		toSerialize["uri"] = o.Uri
	}
	if !IsNil(o.Expire) {
		toSerialize["expire"] = o.Expire
	}

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

	return toSerialize, nil
}

func (o *DeploymentInstructionsArtifactSource) UnmarshalJSON(data []byte) (err error) {
	varDeploymentInstructionsArtifactSource := _DeploymentInstructionsArtifactSource{}

	err = json.Unmarshal(data, &varDeploymentInstructionsArtifactSource)

	if err != nil {
		return err
	}

	*o = DeploymentInstructionsArtifactSource(varDeploymentInstructionsArtifactSource)

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

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

	return err
}

type NullableDeploymentInstructionsArtifactSource struct {
	value *DeploymentInstructionsArtifactSource
	isSet bool
}

func (v NullableDeploymentInstructionsArtifactSource) Get() *DeploymentInstructionsArtifactSource {
	return v.value
}

func (v *NullableDeploymentInstructionsArtifactSource) Set(val *DeploymentInstructionsArtifactSource) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableDeploymentInstructionsArtifactSource(val *DeploymentInstructionsArtifactSource) *NullableDeploymentInstructionsArtifactSource {
	return &NullableDeploymentInstructionsArtifactSource{value: val, isSet: true}
}

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

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


