/*
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 TravelAgency type satisfies the MappedNullable interface at compile time
var _ common.MappedNullable = &TravelAgency{}

// TravelAgency struct for TravelAgency
type TravelAgency struct {
	// The unique identifier from IATA or ARC for the travel agency that issues the ticket. * Encoding: ASCII * minLength: 1 character * maxLength: 8 characters * Must not start with a space or be all spaces. * Must not be all zeros.
	Code *string `json:"code,omitempty"`
	// The name of the travel agency.  * Encoding: ASCII * minLength: 1 character * maxLength: 25 characters * Must not start with a space or be all spaces. * Must not be all zeros.
	Name *string `json:"name,omitempty"`
}

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

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

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

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

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

	return false
}

// SetCode gets a reference to the given string and assigns it to the Code field.
func (o *TravelAgency) SetCode(v string) {
	o.Code = &v
}

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

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

	return false
}

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

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

func (o TravelAgency) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	if !common.IsNil(o.Code) {
		toSerialize["code"] = o.Code
	}
	if !common.IsNil(o.Name) {
		toSerialize["name"] = o.Name
	}
	return toSerialize, nil
}

type NullableTravelAgency struct {
	value *TravelAgency
	isSet bool
}

func (v NullableTravelAgency) Get() *TravelAgency {
	return v.value
}

func (v *NullableTravelAgency) Set(val *TravelAgency) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableTravelAgency(val *TravelAgency) *NullableTravelAgency {
	return &NullableTravelAgency{value: val, isSet: true}
}

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

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