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

// PolicyBundle A bundle containing a set of policies, whitelists, and rules for mapping them to specific images
type PolicyBundle struct {
	// Id of the bundle
	Id string `json:"id"`
	// Human readable name for the bundle
	Name *string `json:"name,omitempty"`
	// Description of the bundle, human readable
	Comment *string `json:"comment,omitempty"`
	// Version id for this bundle format
	Version string `json:"version"`
	// Whitelists which define which policy matches to disregard explicitly in the final policy decision
	Whitelists []Whitelist `json:"whitelists,omitempty"`
	// Policies which define the go/stop/warn status of an image using rule matches on image properties
	Policies []Policy `json:"policies"`
	// Mapping rules for defining which policy and whitelist(s) to apply to an image based on a match of the image tag or id. Evaluated in order.
	Mappings []MappingRule `json:"mappings"`
	// List of mapping rules that define which images should always be passed (unless also on the blacklist), regardless of policy result.
	WhitelistedImages []ImageSelectionRule `json:"whitelisted_images,omitempty"`
	// List of mapping rules that define which images should always result in a STOP/FAIL policy result regardless of policy content or presence in whitelisted_images
	BlacklistedImages []ImageSelectionRule `json:"blacklisted_images,omitempty"`
}

// NewPolicyBundle instantiates a new PolicyBundle 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 NewPolicyBundle(id string, version string, policies []Policy, mappings []MappingRule) *PolicyBundle {
	this := PolicyBundle{}
	this.Id = id
	this.Version = version
	this.Policies = policies
	this.Mappings = mappings
	return &this
}

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

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

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

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

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

	return false
}

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

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

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

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

	return false
}

// SetComment gets a reference to the given string and assigns it to the Comment field.
func (o *PolicyBundle) SetComment(v string) {
	o.Comment = &v
}

// GetVersion returns the Version field value
func (o *PolicyBundle) GetVersion() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.Version
}

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

// SetVersion sets field value
func (o *PolicyBundle) SetVersion(v string) {
	o.Version = v
}

// GetWhitelists returns the Whitelists field value if set, zero value otherwise.
func (o *PolicyBundle) GetWhitelists() []Whitelist {
	if o == nil || o.Whitelists == nil {
		var ret []Whitelist
		return ret
	}
	return o.Whitelists
}

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

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

	return false
}

// SetWhitelists gets a reference to the given []Whitelist and assigns it to the Whitelists field.
func (o *PolicyBundle) SetWhitelists(v []Whitelist) {
	o.Whitelists = v
}

// GetPolicies returns the Policies field value
func (o *PolicyBundle) GetPolicies() []Policy {
	if o == nil {
		var ret []Policy
		return ret
	}

	return o.Policies
}

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

// SetPolicies sets field value
func (o *PolicyBundle) SetPolicies(v []Policy) {
	o.Policies = v
}

// GetMappings returns the Mappings field value
func (o *PolicyBundle) GetMappings() []MappingRule {
	if o == nil {
		var ret []MappingRule
		return ret
	}

	return o.Mappings
}

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

// SetMappings sets field value
func (o *PolicyBundle) SetMappings(v []MappingRule) {
	o.Mappings = v
}

// GetWhitelistedImages returns the WhitelistedImages field value if set, zero value otherwise.
func (o *PolicyBundle) GetWhitelistedImages() []ImageSelectionRule {
	if o == nil || o.WhitelistedImages == nil {
		var ret []ImageSelectionRule
		return ret
	}
	return o.WhitelistedImages
}

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

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

	return false
}

// SetWhitelistedImages gets a reference to the given []ImageSelectionRule and assigns it to the WhitelistedImages field.
func (o *PolicyBundle) SetWhitelistedImages(v []ImageSelectionRule) {
	o.WhitelistedImages = v
}

// GetBlacklistedImages returns the BlacklistedImages field value if set, zero value otherwise.
func (o *PolicyBundle) GetBlacklistedImages() []ImageSelectionRule {
	if o == nil || o.BlacklistedImages == nil {
		var ret []ImageSelectionRule
		return ret
	}
	return o.BlacklistedImages
}

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

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

	return false
}

// SetBlacklistedImages gets a reference to the given []ImageSelectionRule and assigns it to the BlacklistedImages field.
func (o *PolicyBundle) SetBlacklistedImages(v []ImageSelectionRule) {
	o.BlacklistedImages = v
}

func (o PolicyBundle) MarshalJSON() ([]byte, error) {
	toSerialize := map[string]interface{}{}
	if true {
		toSerialize["id"] = o.Id
	}
	if o.Name != nil {
		toSerialize["name"] = o.Name
	}
	if o.Comment != nil {
		toSerialize["comment"] = o.Comment
	}
	if true {
		toSerialize["version"] = o.Version
	}
	if o.Whitelists != nil {
		toSerialize["whitelists"] = o.Whitelists
	}
	if true {
		toSerialize["policies"] = o.Policies
	}
	if true {
		toSerialize["mappings"] = o.Mappings
	}
	if o.WhitelistedImages != nil {
		toSerialize["whitelisted_images"] = o.WhitelistedImages
	}
	if o.BlacklistedImages != nil {
		toSerialize["blacklisted_images"] = o.BlacklistedImages
	}
	return json.Marshal(toSerialize)
}

type NullablePolicyBundle struct {
	value *PolicyBundle
	isSet bool
}

func (v NullablePolicyBundle) Get() *PolicyBundle {
	return v.value
}

func (v *NullablePolicyBundle) Set(val *PolicyBundle) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullablePolicyBundle(val *PolicyBundle) *NullablePolicyBundle {
	return &NullablePolicyBundle{value: val, isSet: true}
}

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

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


