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

// VulnerableImage A record of an image vulnerable to some known vulnerability. Includes vulnerable package information
type VulnerableImage struct {
	Image *ImageReference `json:"image,omitempty"`
	AffectedPackages []VulnerablePackageReference `json:"affected_packages,omitempty"`
}

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

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

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

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

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

	return false
}

// SetImage gets a reference to the given ImageReference and assigns it to the Image field.
func (o *VulnerableImage) SetImage(v ImageReference) {
	o.Image = &v
}

// GetAffectedPackages returns the AffectedPackages field value if set, zero value otherwise.
func (o *VulnerableImage) GetAffectedPackages() []VulnerablePackageReference {
	if o == nil || o.AffectedPackages == nil {
		var ret []VulnerablePackageReference
		return ret
	}
	return o.AffectedPackages
}

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

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

	return false
}

// SetAffectedPackages gets a reference to the given []VulnerablePackageReference and assigns it to the AffectedPackages field.
func (o *VulnerableImage) SetAffectedPackages(v []VulnerablePackageReference) {
	o.AffectedPackages = v
}

func (o VulnerableImage) MarshalJSON() ([]byte, error) {
	toSerialize := map[string]interface{}{}
	if o.Image != nil {
		toSerialize["image"] = o.Image
	}
	if o.AffectedPackages != nil {
		toSerialize["affected_packages"] = o.AffectedPackages
	}
	return json.Marshal(toSerialize)
}

type NullableVulnerableImage struct {
	value *VulnerableImage
	isSet bool
}

func (v NullableVulnerableImage) Get() *VulnerableImage {
	return v.value
}

func (v *NullableVulnerableImage) Set(val *VulnerableImage) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableVulnerableImage(val *VulnerableImage) *NullableVulnerableImage {
	return &NullableVulnerableImage{value: val, isSet: true}
}

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

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


