/*
Adyen Checkout API

API version: 71
*/

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

package checkout

import (
	"encoding/json"
	"time"

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

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

// Airline struct for Airline
type Airline struct {
	Agency *Agency `json:"agency,omitempty"`
	// The amount charged for boarding the plane, in [minor units](https://docs.adyen.com/development-resources/currency-codes). * Encoding: Numeric * minLength: 1 character * maxLength: 11 characters
	BoardingFee *int64 `json:"boardingFee,omitempty"`
	// The [IATA](https://www.iata.org/services/pages/codes.aspx) 3-digit accounting code (PAX) that identifies the carrier. * Format: IATA 3-digit accounting code (PAX) * Example: KLM = 074 * minLength: 3 characters * maxLength: 3 characters * Must not start with a space or be all spaces. * Must not be all zeros.
	Code *string `json:"code,omitempty"`
	// The [CRS](https://en.wikipedia.org/wiki/Computer_reservation_system) used to make the reservation and purchase the ticket. * Encoding: ASCII * minLength: 4 characters * maxLength: 4 characters
	ComputerizedReservationSystem *string `json:"computerizedReservationSystem,omitempty"`
	// The alphanumeric customer reference number. * Encoding: ASCII * maxLength: 20 characters * If you send more than 20 characters, the customer reference number is truncated * Must not start with a space or be all spaces.
	CustomerReferenceNumber *string `json:"customerReferenceNumber,omitempty"`
	// The [IATA](https://www.iata.org/services/pages/codes.aspx) 2-letter accounting code (PAX) that identifies the carrier. * Encoding: ASCII * Example: KLM = KL * minLength: 2 characters * maxLength: 2 characters * Must not start with a space or be all spaces.
	DesignatorCode *string `json:"designatorCode,omitempty"`
	// A code that identifies the type of item bought. The description of the code can appear on credit card statements. * Encoding: ASCII * Example: Passenger ticket = 01 * minLength: 2 characters * maxLength: 2 characters
	DocumentType *string `json:"documentType,omitempty"`
	// The flight departure date. Time is optional. * Format for date only: `yyyy-MM-dd` * Format for date and time: `yyyy-MM-ddTHH:mm` * Use local time of departure airport. * minLength: 10 characters * maxLength: 16 characters
	FlightDate *time.Time `json:"flightDate,omitempty"`
	Legs       []Leg      `json:"legs,omitempty"`
	// The passenger's name, initials, and title. * Format: last name + first name or initials + title * Example: *FLYER / MARY MS* * minLength: 1 character * maxLength: 20 characters * If you send more than 20 characters, the name is truncated * Must not start with a space or be all spaces. * Must not be all zeros.
	PassengerName string        `json:"passengerName"`
	Passengers    []Passenger   `json:"passengers,omitempty"`
	Ticket        *Ticket       `json:"ticket,omitempty"`
	TravelAgency  *TravelAgency `json:"travelAgency,omitempty"`
}

// NewAirline instantiates a new Airline 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 NewAirline(passengerName string) *Airline {
	this := Airline{}
	this.PassengerName = passengerName
	return &this
}

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

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

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

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

	return false
}

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

// GetBoardingFee returns the BoardingFee field value if set, zero value otherwise.
func (o *Airline) GetBoardingFee() int64 {
	if o == nil || common.IsNil(o.BoardingFee) {
		var ret int64
		return ret
	}
	return *o.BoardingFee
}

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

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

	return false
}

// SetBoardingFee gets a reference to the given int64 and assigns it to the BoardingFee field.
func (o *Airline) SetBoardingFee(v int64) {
	o.BoardingFee = &v
}

// GetCode returns the Code field value if set, zero value otherwise.
func (o *Airline) 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 *Airline) 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 *Airline) 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 *Airline) SetCode(v string) {
	o.Code = &v
}

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

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

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

	return false
}

// SetComputerizedReservationSystem gets a reference to the given string and assigns it to the ComputerizedReservationSystem field.
func (o *Airline) SetComputerizedReservationSystem(v string) {
	o.ComputerizedReservationSystem = &v
}

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

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

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

	return false
}

// SetCustomerReferenceNumber gets a reference to the given string and assigns it to the CustomerReferenceNumber field.
func (o *Airline) SetCustomerReferenceNumber(v string) {
	o.CustomerReferenceNumber = &v
}

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

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

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

	return false
}

// SetDesignatorCode gets a reference to the given string and assigns it to the DesignatorCode field.
func (o *Airline) SetDesignatorCode(v string) {
	o.DesignatorCode = &v
}

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

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

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

	return false
}

// SetDocumentType gets a reference to the given string and assigns it to the DocumentType field.
func (o *Airline) SetDocumentType(v string) {
	o.DocumentType = &v
}

// GetFlightDate returns the FlightDate field value if set, zero value otherwise.
func (o *Airline) GetFlightDate() time.Time {
	if o == nil || common.IsNil(o.FlightDate) {
		var ret time.Time
		return ret
	}
	return *o.FlightDate
}

// GetFlightDateOk returns a tuple with the FlightDate field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *Airline) GetFlightDateOk() (*time.Time, bool) {
	if o == nil || common.IsNil(o.FlightDate) {
		return nil, false
	}
	return o.FlightDate, true
}

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

	return false
}

// SetFlightDate gets a reference to the given time.Time and assigns it to the FlightDate field.
func (o *Airline) SetFlightDate(v time.Time) {
	o.FlightDate = &v
}

// GetLegs returns the Legs field value if set, zero value otherwise.
func (o *Airline) GetLegs() []Leg {
	if o == nil || common.IsNil(o.Legs) {
		var ret []Leg
		return ret
	}
	return o.Legs
}

// GetLegsOk returns a tuple with the Legs field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *Airline) GetLegsOk() ([]Leg, bool) {
	if o == nil || common.IsNil(o.Legs) {
		return nil, false
	}
	return o.Legs, true
}

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

	return false
}

// SetLegs gets a reference to the given []Leg and assigns it to the Legs field.
func (o *Airline) SetLegs(v []Leg) {
	o.Legs = v
}

// GetPassengerName returns the PassengerName field value
func (o *Airline) GetPassengerName() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.PassengerName
}

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

// SetPassengerName sets field value
func (o *Airline) SetPassengerName(v string) {
	o.PassengerName = v
}

// GetPassengers returns the Passengers field value if set, zero value otherwise.
func (o *Airline) GetPassengers() []Passenger {
	if o == nil || common.IsNil(o.Passengers) {
		var ret []Passenger
		return ret
	}
	return o.Passengers
}

// GetPassengersOk returns a tuple with the Passengers field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *Airline) GetPassengersOk() ([]Passenger, bool) {
	if o == nil || common.IsNil(o.Passengers) {
		return nil, false
	}
	return o.Passengers, true
}

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

	return false
}

// SetPassengers gets a reference to the given []Passenger and assigns it to the Passengers field.
func (o *Airline) SetPassengers(v []Passenger) {
	o.Passengers = v
}

// GetTicket returns the Ticket field value if set, zero value otherwise.
func (o *Airline) GetTicket() Ticket {
	if o == nil || common.IsNil(o.Ticket) {
		var ret Ticket
		return ret
	}
	return *o.Ticket
}

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

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

	return false
}

// SetTicket gets a reference to the given Ticket and assigns it to the Ticket field.
func (o *Airline) SetTicket(v Ticket) {
	o.Ticket = &v
}

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

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

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

	return false
}

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

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

func (o Airline) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	if !common.IsNil(o.Agency) {
		toSerialize["agency"] = o.Agency
	}
	if !common.IsNil(o.BoardingFee) {
		toSerialize["boardingFee"] = o.BoardingFee
	}
	if !common.IsNil(o.Code) {
		toSerialize["code"] = o.Code
	}
	if !common.IsNil(o.ComputerizedReservationSystem) {
		toSerialize["computerizedReservationSystem"] = o.ComputerizedReservationSystem
	}
	if !common.IsNil(o.CustomerReferenceNumber) {
		toSerialize["customerReferenceNumber"] = o.CustomerReferenceNumber
	}
	if !common.IsNil(o.DesignatorCode) {
		toSerialize["designatorCode"] = o.DesignatorCode
	}
	if !common.IsNil(o.DocumentType) {
		toSerialize["documentType"] = o.DocumentType
	}
	if !common.IsNil(o.FlightDate) {
		toSerialize["flightDate"] = o.FlightDate
	}
	if !common.IsNil(o.Legs) {
		toSerialize["legs"] = o.Legs
	}
	toSerialize["passengerName"] = o.PassengerName
	if !common.IsNil(o.Passengers) {
		toSerialize["passengers"] = o.Passengers
	}
	if !common.IsNil(o.Ticket) {
		toSerialize["ticket"] = o.Ticket
	}
	if !common.IsNil(o.TravelAgency) {
		toSerialize["travelAgency"] = o.TravelAgency
	}
	return toSerialize, nil
}

type NullableAirline struct {
	value *Airline
	isSet bool
}

func (v NullableAirline) Get() *Airline {
	return v.value
}

func (v *NullableAirline) Set(val *Airline) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableAirline(val *Airline) *NullableAirline {
	return &NullableAirline{value: val, isSet: true}
}

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

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