/*
Adyen Checkout API

API version: 71
*/

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

package checkout

import (
	"encoding/json"

	"github.com/adyen/adyen-go-api-library/v21/src/common"
)

// checks if the Agency type satisfies the MappedNullable interface at compile time
var _ common.MappedNullable = &Agency{}

// Agency struct for Agency
type Agency struct {
	// The reference number for the invoice, issued by the agency. * Encoding: ASCII * minLength: 1 character * maxLength: 6 characters
	InvoiceNumber *string `json:"invoiceNumber,omitempty"`
	// The two-letter agency plan identifier. * Encoding: ASCII * minLength: 2 characters * maxLength: 2 characters
	PlanName *string `json:"planName,omitempty"`
}

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

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

// GetInvoiceNumber returns the InvoiceNumber field value if set, zero value otherwise.
func (o *Agency) GetInvoiceNumber() string {
	if o == nil || common.IsNil(o.InvoiceNumber) {
		var ret string
		return ret
	}
	return *o.InvoiceNumber
}

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

// HasInvoiceNumber returns a boolean if a field has been set.
func (o *Agency) HasInvoiceNumber() bool {
	if o != nil && !common.IsNil(o.InvoiceNumber) {
		return true
	}

	return false
}

// SetInvoiceNumber gets a reference to the given string and assigns it to the InvoiceNumber field.
func (o *Agency) SetInvoiceNumber(v string) {
	o.InvoiceNumber = &v
}

// GetPlanName returns the PlanName field value if set, zero value otherwise.
func (o *Agency) GetPlanName() string {
	if o == nil || common.IsNil(o.PlanName) {
		var ret string
		return ret
	}
	return *o.PlanName
}

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

// HasPlanName returns a boolean if a field has been set.
func (o *Agency) HasPlanName() bool {
	if o != nil && !common.IsNil(o.PlanName) {
		return true
	}

	return false
}

// SetPlanName gets a reference to the given string and assigns it to the PlanName field.
func (o *Agency) SetPlanName(v string) {
	o.PlanName = &v
}

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

func (o Agency) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	if !common.IsNil(o.InvoiceNumber) {
		toSerialize["invoiceNumber"] = o.InvoiceNumber
	}
	if !common.IsNil(o.PlanName) {
		toSerialize["planName"] = o.PlanName
	}
	return toSerialize, nil
}

type NullableAgency struct {
	value *Agency
	isSet bool
}

func (v NullableAgency) Get() *Agency {
	return v.value
}

func (v *NullableAgency) Set(val *Agency) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableAgency(val *Agency) *NullableAgency {
	return &NullableAgency{value: val, isSet: true}
}

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

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