/*
Transfer webhooks

API version: 4
*/

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

package transferwebhook

import (
	"encoding/json"

	"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 {
	// Details about the flight legs for this ticket.
	Legs []Leg `json:"legs,omitempty"`
	// The ticket's unique identifier
	TicketNumber *string `json:"ticketNumber,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() *Airline {
	this := Airline{}
	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
}

// 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
}

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

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

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

	return false
}

// SetTicketNumber gets a reference to the given string and assigns it to the TicketNumber field.
func (o *Airline) SetTicketNumber(v string) {
	o.TicketNumber = &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.Legs) {
		toSerialize["legs"] = o.Legs
	}
	if !common.IsNil(o.TicketNumber) {
		toSerialize["ticketNumber"] = o.TicketNumber
	}
	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)
}
