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

// PolicyRule A rule that defines and decision value if the match is found true for a given image.
type PolicyRule struct {
	Id *string `json:"id,omitempty"`
	Gate string `json:"gate"`
	Trigger string `json:"trigger"`
	Action string `json:"action"`
	Params []PolicyRuleParamsInner `json:"params"`
}

// NewPolicyRule instantiates a new PolicyRule 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 NewPolicyRule(gate string, trigger string, action string) *PolicyRule {
	this := PolicyRule{}
	this.Gate = gate
	this.Trigger = trigger
	this.Action = action
	return &this
}

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

// GetId returns the Id field value if set, zero value otherwise.
func (o *PolicyRule) 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 *PolicyRule) 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 *PolicyRule) 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 *PolicyRule) SetId(v string) {
	o.Id = &v
}

// GetGate returns the Gate field value
func (o *PolicyRule) GetGate() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.Gate
}

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

// SetGate sets field value
func (o *PolicyRule) SetGate(v string) {
	o.Gate = v
}

// GetTrigger returns the Trigger field value
func (o *PolicyRule) GetTrigger() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.Trigger
}

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

// SetTrigger sets field value
func (o *PolicyRule) SetTrigger(v string) {
	o.Trigger = v
}

// GetAction returns the Action field value
func (o *PolicyRule) GetAction() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.Action
}

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

// SetAction sets field value
func (o *PolicyRule) SetAction(v string) {
	o.Action = v
}

// GetParams returns the Params field value if set, zero value otherwise.
func (o *PolicyRule) GetParams() []PolicyRuleParamsInner {
	if o == nil || o.Params == nil {
		var ret []PolicyRuleParamsInner
		return ret
	}
	return o.Params
}

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

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

	return false
}

// SetParams gets a reference to the given []PolicyRuleParamsInner and assigns it to the Params field.
func (o *PolicyRule) SetParams(v []PolicyRuleParamsInner) {
	o.Params = v
}

func (o PolicyRule) MarshalJSON() ([]byte, error) {
	toSerialize := map[string]interface{}{}
	if o.Id != nil {
		toSerialize["id"] = o.Id
	}
	if true {
		toSerialize["gate"] = o.Gate
	}
	if true {
		toSerialize["trigger"] = o.Trigger
	}
	if true {
		toSerialize["action"] = o.Action
	}
	if o.Params != nil {
		toSerialize["params"] = o.Params
	}
	return json.Marshal(toSerialize)
}

type NullablePolicyRule struct {
	value *PolicyRule
	isSet bool
}

func (v NullablePolicyRule) Get() *PolicyRule {
	return v.value
}

func (v *NullablePolicyRule) Set(val *PolicyRule) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullablePolicyRule(val *PolicyRule) *NullablePolicyRule {
	return &NullablePolicyRule{value: val, isSet: true}
}

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

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


