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

// ReleaseV2 Groups artifacts with the same release name into a single resource.
type ReleaseV2 struct {
	// release name. 
	Name *string `json:"name,omitempty"`
	// Last modification time for the release. 
	Modified *time.Time `json:"modified,omitempty"`
	// List of artifacts for this release.
	Artifacts []ArtifactV2 `json:"artifacts,omitempty"`
	// Tags assigned to the release used for filtering releases. Each tag must be valid a ASCII string and contain only lowercase and uppercase letters, digits, underscores, periods and hyphens.
	Tags []string `json:"tags,omitempty"`
	// Additional information describing a Release limited to 1024 characters. Please use the v2 API to set this field. 
	Notes *string `json:"notes,omitempty"`
	AdditionalProperties map[string]interface{}
}

type _ReleaseV2 ReleaseV2

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

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

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

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

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

	return false
}

// SetName gets a reference to the given string and assigns it to the Name field.
func (o *ReleaseV2) SetName(v string) {
	o.Name = &v
}

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

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

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

	return false
}

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

// GetArtifacts returns the Artifacts field value if set, zero value otherwise.
func (o *ReleaseV2) GetArtifacts() []ArtifactV2 {
	if o == nil || IsNil(o.Artifacts) {
		var ret []ArtifactV2
		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 *ReleaseV2) GetArtifactsOk() ([]ArtifactV2, 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 *ReleaseV2) HasArtifacts() bool {
	if o != nil && !IsNil(o.Artifacts) {
		return true
	}

	return false
}

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

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

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

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

	return false
}

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

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

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

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

	return false
}

// SetNotes gets a reference to the given string and assigns it to the Notes field.
func (o *ReleaseV2) SetNotes(v string) {
	o.Notes = &v
}

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

func (o ReleaseV2) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	if !IsNil(o.Name) {
		toSerialize["name"] = o.Name
	}
	if !IsNil(o.Modified) {
		toSerialize["modified"] = o.Modified
	}
	if !IsNil(o.Artifacts) {
		toSerialize["artifacts"] = o.Artifacts
	}
	if !IsNil(o.Tags) {
		toSerialize["tags"] = o.Tags
	}
	if !IsNil(o.Notes) {
		toSerialize["notes"] = o.Notes
	}

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

	return toSerialize, nil
}

func (o *ReleaseV2) UnmarshalJSON(data []byte) (err error) {
	varReleaseV2 := _ReleaseV2{}

	err = json.Unmarshal(data, &varReleaseV2)

	if err != nil {
		return err
	}

	*o = ReleaseV2(varReleaseV2)

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

	if err = json.Unmarshal(data, &additionalProperties); err == nil {
		delete(additionalProperties, "name")
		delete(additionalProperties, "modified")
		delete(additionalProperties, "artifacts")
		delete(additionalProperties, "tags")
		delete(additionalProperties, "notes")
		o.AdditionalProperties = additionalProperties
	}

	return err
}

type NullableReleaseV2 struct {
	value *ReleaseV2
	isSet bool
}

func (v NullableReleaseV2) Get() *ReleaseV2 {
	return v.value
}

func (v *NullableReleaseV2) Set(val *ReleaseV2) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableReleaseV2(val *ReleaseV2) *NullableReleaseV2 {
	return &NullableReleaseV2{value: val, isSet: true}
}

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

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


