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

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

// ArtifactInfo Information about artifact format and version.
type ArtifactInfo struct {
	Format *string `json:"format,omitempty"`
	Version *int32 `json:"version,omitempty"`
	AdditionalProperties map[string]interface{}
}

type _ArtifactInfo ArtifactInfo

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

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

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

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

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

	return false
}

// SetFormat gets a reference to the given string and assigns it to the Format field.
func (o *ArtifactInfo) SetFormat(v string) {
	o.Format = &v
}

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

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

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

	return false
}

// SetVersion gets a reference to the given int32 and assigns it to the Version field.
func (o *ArtifactInfo) SetVersion(v int32) {
	o.Version = &v
}

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

func (o ArtifactInfo) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	if !IsNil(o.Format) {
		toSerialize["format"] = o.Format
	}
	if !IsNil(o.Version) {
		toSerialize["version"] = o.Version
	}

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

	return toSerialize, nil
}

func (o *ArtifactInfo) UnmarshalJSON(data []byte) (err error) {
	varArtifactInfo := _ArtifactInfo{}

	err = json.Unmarshal(data, &varArtifactInfo)

	if err != nil {
		return err
	}

	*o = ArtifactInfo(varArtifactInfo)

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

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

	return err
}

type NullableArtifactInfo struct {
	value *ArtifactInfo
	isSet bool
}

func (v NullableArtifactInfo) Get() *ArtifactInfo {
	return v.value
}

func (v *NullableArtifactInfo) Set(val *ArtifactInfo) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableArtifactInfo(val *ArtifactInfo) *NullableArtifactInfo {
	return &NullableArtifactInfo{value: val, isSet: true}
}

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

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


