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

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

// ArtifactV1 Detailed artifact.
type ArtifactV1 struct {
	Id string `json:"id"`
	Name string `json:"name"`
	Description *string `json:"description,omitempty"`
	// An array of compatible device types.
	DeviceTypesCompatible []string `json:"device_types_compatible"`
	Info *ArtifactInfo `json:"info,omitempty"`
	// Idicates if artifact is signed or not.
	Signed *bool `json:"signed,omitempty"`
	Updates []Update `json:"updates,omitempty"`
	// List of Artifact provides.  Map of key/value pairs, where both keys and values are strings. 
	ArtifactProvides *map[string]string `json:"artifact_provides,omitempty"`
	// List of Artifact depends.  Map of key/value pairs, where keys are strings and values are lists of strings. 
	ArtifactDepends *map[string][]string `json:"artifact_depends,omitempty"`
	// List of Clear Artifact provides.
	ClearsArtifactProvides []string `json:"clears_artifact_provides,omitempty"`
	// Artifact total size in bytes - the size of the actual file that will be transferred to the device (compressed). 
	Size *int32 `json:"size,omitempty"`
	// Represents creation / last edition of any of the artifact properties. 
	Modified time.Time `json:"modified"`
}

type _ArtifactV1 ArtifactV1

// NewArtifactV1 instantiates a new ArtifactV1 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 NewArtifactV1(id string, name string, deviceTypesCompatible []string, modified time.Time) *ArtifactV1 {
	this := ArtifactV1{}
	this.Id = id
	this.Name = name
	this.DeviceTypesCompatible = deviceTypesCompatible
	this.Modified = modified
	return &this
}

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

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

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

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

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

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

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

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

	return false
}

// SetDescription gets a reference to the given string and assigns it to the Description field.
func (o *ArtifactV1) SetDescription(v string) {
	o.Description = &v
}

// GetDeviceTypesCompatible returns the DeviceTypesCompatible field value
func (o *ArtifactV1) GetDeviceTypesCompatible() []string {
	if o == nil {
		var ret []string
		return ret
	}

	return o.DeviceTypesCompatible
}

// GetDeviceTypesCompatibleOk returns a tuple with the DeviceTypesCompatible field value
// and a boolean to check if the value has been set.
func (o *ArtifactV1) GetDeviceTypesCompatibleOk() ([]string, bool) {
	if o == nil {
		return nil, false
	}
	return o.DeviceTypesCompatible, true
}

// SetDeviceTypesCompatible sets field value
func (o *ArtifactV1) SetDeviceTypesCompatible(v []string) {
	o.DeviceTypesCompatible = v
}

// GetInfo returns the Info field value if set, zero value otherwise.
func (o *ArtifactV1) GetInfo() ArtifactInfo {
	if o == nil || IsNil(o.Info) {
		var ret ArtifactInfo
		return ret
	}
	return *o.Info
}

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

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

	return false
}

// SetInfo gets a reference to the given ArtifactInfo and assigns it to the Info field.
func (o *ArtifactV1) SetInfo(v ArtifactInfo) {
	o.Info = &v
}

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

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

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

	return false
}

// SetSigned gets a reference to the given bool and assigns it to the Signed field.
func (o *ArtifactV1) SetSigned(v bool) {
	o.Signed = &v
}

// GetUpdates returns the Updates field value if set, zero value otherwise.
func (o *ArtifactV1) GetUpdates() []Update {
	if o == nil || IsNil(o.Updates) {
		var ret []Update
		return ret
	}
	return o.Updates
}

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

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

	return false
}

// SetUpdates gets a reference to the given []Update and assigns it to the Updates field.
func (o *ArtifactV1) SetUpdates(v []Update) {
	o.Updates = v
}

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

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

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

	return false
}

// SetArtifactProvides gets a reference to the given map[string]string and assigns it to the ArtifactProvides field.
func (o *ArtifactV1) SetArtifactProvides(v map[string]string) {
	o.ArtifactProvides = &v
}

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

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

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

	return false
}

// SetArtifactDepends gets a reference to the given map[string][]string and assigns it to the ArtifactDepends field.
func (o *ArtifactV1) SetArtifactDepends(v map[string][]string) {
	o.ArtifactDepends = &v
}

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

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

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

	return false
}

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

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

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

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

	return false
}

// SetSize gets a reference to the given int32 and assigns it to the Size field.
func (o *ArtifactV1) SetSize(v int32) {
	o.Size = &v
}

// GetModified returns the Modified field value
func (o *ArtifactV1) GetModified() time.Time {
	if o == nil {
		var ret time.Time
		return ret
	}

	return o.Modified
}

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

// SetModified sets field value
func (o *ArtifactV1) SetModified(v time.Time) {
	o.Modified = v
}

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

func (o ArtifactV1) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	toSerialize["id"] = o.Id
	toSerialize["name"] = o.Name
	if !IsNil(o.Description) {
		toSerialize["description"] = o.Description
	}
	toSerialize["device_types_compatible"] = o.DeviceTypesCompatible
	if !IsNil(o.Info) {
		toSerialize["info"] = o.Info
	}
	if !IsNil(o.Signed) {
		toSerialize["signed"] = o.Signed
	}
	if !IsNil(o.Updates) {
		toSerialize["updates"] = o.Updates
	}
	if !IsNil(o.ArtifactProvides) {
		toSerialize["artifact_provides"] = o.ArtifactProvides
	}
	if !IsNil(o.ArtifactDepends) {
		toSerialize["artifact_depends"] = o.ArtifactDepends
	}
	if !IsNil(o.ClearsArtifactProvides) {
		toSerialize["clears_artifact_provides"] = o.ClearsArtifactProvides
	}
	if !IsNil(o.Size) {
		toSerialize["size"] = o.Size
	}
	toSerialize["modified"] = o.Modified
	return toSerialize, nil
}

func (o *ArtifactV1) 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",
		"name",
		"device_types_compatible",
		"modified",
	}

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

	varArtifactV1 := _ArtifactV1{}

	decoder := json.NewDecoder(bytes.NewReader(data))
	decoder.DisallowUnknownFields()
	err = decoder.Decode(&varArtifactV1)

	if err != nil {
		return err
	}

	*o = ArtifactV1(varArtifactV1)

	return err
}

type NullableArtifactV1 struct {
	value *ArtifactV1
	isSet bool
}

func (v NullableArtifactV1) Get() *ArtifactV1 {
	return v.value
}

func (v *NullableArtifactV1) Set(val *ArtifactV1) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableArtifactV1(val *ArtifactV1) *NullableArtifactV1 {
	return &NullableArtifactV1{value: val, isSet: true}
}

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

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


