/*
Anchore Engine API Server

This is the Anchore Engine API. Provides the primary external API for users of the service.

API version: 0.1.20
Contact: nurmi@anchore.com
*/

// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.

package anchore

import (
	"encoding/json"
)

// ImageReference A summary of an image identity, including digest, id (if available), and any tags known to have ever been mapped to the digest
type ImageReference struct {
	// The image digest
	Digest *string `json:"digest,omitempty"`
	// The image id if available
	Id *string `json:"id,omitempty"`
	// Timestamp, in rfc3339 format, indicating when the image state became 'analyzed' in Anchore Engine.
	AnalyzedAt *string `json:"analyzed_at,omitempty"`
	TagHistory []TagEntry `json:"tag_history,omitempty"`
}

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

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

// GetDigest returns the Digest field value if set, zero value otherwise.
func (o *ImageReference) GetDigest() string {
	if o == nil || o.Digest == nil {
		var ret string
		return ret
	}
	return *o.Digest
}

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

// HasDigest returns a boolean if a field has been set.
func (o *ImageReference) HasDigest() bool {
	if o != nil && o.Digest != nil {
		return true
	}

	return false
}

// SetDigest gets a reference to the given string and assigns it to the Digest field.
func (o *ImageReference) SetDigest(v string) {
	o.Digest = &v
}

// GetId returns the Id field value if set, zero value otherwise.
func (o *ImageReference) GetId() string {
	if o == nil || o.Id == nil {
		var ret string
		return ret
	}
	return *o.Id
}

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

// HasId returns a boolean if a field has been set.
func (o *ImageReference) HasId() bool {
	if o != nil && o.Id != nil {
		return true
	}

	return false
}

// SetId gets a reference to the given string and assigns it to the Id field.
func (o *ImageReference) SetId(v string) {
	o.Id = &v
}

// GetAnalyzedAt returns the AnalyzedAt field value if set, zero value otherwise.
func (o *ImageReference) GetAnalyzedAt() string {
	if o == nil || o.AnalyzedAt == nil {
		var ret string
		return ret
	}
	return *o.AnalyzedAt
}

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

// HasAnalyzedAt returns a boolean if a field has been set.
func (o *ImageReference) HasAnalyzedAt() bool {
	if o != nil && o.AnalyzedAt != nil {
		return true
	}

	return false
}

// SetAnalyzedAt gets a reference to the given string and assigns it to the AnalyzedAt field.
func (o *ImageReference) SetAnalyzedAt(v string) {
	o.AnalyzedAt = &v
}

// GetTagHistory returns the TagHistory field value if set, zero value otherwise.
func (o *ImageReference) GetTagHistory() []TagEntry {
	if o == nil || o.TagHistory == nil {
		var ret []TagEntry
		return ret
	}
	return o.TagHistory
}

// GetTagHistoryOk returns a tuple with the TagHistory field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *ImageReference) GetTagHistoryOk() ([]TagEntry, bool) {
	if o == nil || o.TagHistory == nil {
		return nil, false
	}
	return o.TagHistory, true
}

// HasTagHistory returns a boolean if a field has been set.
func (o *ImageReference) HasTagHistory() bool {
	if o != nil && o.TagHistory != nil {
		return true
	}

	return false
}

// SetTagHistory gets a reference to the given []TagEntry and assigns it to the TagHistory field.
func (o *ImageReference) SetTagHistory(v []TagEntry) {
	o.TagHistory = v
}

func (o ImageReference) MarshalJSON() ([]byte, error) {
	toSerialize := map[string]interface{}{}
	if o.Digest != nil {
		toSerialize["digest"] = o.Digest
	}
	if o.Id != nil {
		toSerialize["id"] = o.Id
	}
	if o.AnalyzedAt != nil {
		toSerialize["analyzed_at"] = o.AnalyzedAt
	}
	if o.TagHistory != nil {
		toSerialize["tag_history"] = o.TagHistory
	}
	return json.Marshal(toSerialize)
}

type NullableImageReference struct {
	value *ImageReference
	isSet bool
}

func (v NullableImageReference) Get() *ImageReference {
	return v.value
}

func (v *NullableImageReference) Set(val *ImageReference) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableImageReference(val *ImageReference) *NullableImageReference {
	return &NullableImageReference{value: val, isSet: true}
}

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

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


