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

// Passenger struct for Passenger
type Passenger struct {
	// The passenger's date of birth. * Format `yyyy-MM-dd` * minLength: 10 * maxLength: 10
	DateOfBirth *string `json:"dateOfBirth,omitempty"`
	// The passenger's first name. > This field is required if the airline data includes passenger details or leg details. * Encoding: ASCII
	FirstName *string `json:"firstName,omitempty"`
	// The passenger's last name. > This field is required if the airline data includes passenger details or leg details. * Encoding: ASCII
	LastName *string `json:"lastName,omitempty"`
	// The passenger's phone number, including country code. This is an alphanumeric field that can include the '+' and '-' signs. * Encoding: ASCII * minLength: 3 characters * maxLength: 30 characters
	PhoneNumber *string `json:"phoneNumber,omitempty"`
	// The IATA passenger type code (PTC). * Encoding: ASCII * minLength: 3 characters * maxLength: 6 characters
	TravellerType *string `json:"travellerType,omitempty"`
}

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

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

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

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

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

	return false
}

// SetDateOfBirth gets a reference to the given string and assigns it to the DateOfBirth field.
func (o *Passenger) SetDateOfBirth(v string) {
	o.DateOfBirth = &v
}

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

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

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

	return false
}

// SetFirstName gets a reference to the given string and assigns it to the FirstName field.
func (o *Passenger) SetFirstName(v string) {
	o.FirstName = &v
}

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

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

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

	return false
}

// SetLastName gets a reference to the given string and assigns it to the LastName field.
func (o *Passenger) SetLastName(v string) {
	o.LastName = &v
}

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

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

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

	return false
}

// SetPhoneNumber gets a reference to the given string and assigns it to the PhoneNumber field.
func (o *Passenger) SetPhoneNumber(v string) {
	o.PhoneNumber = &v
}

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

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

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

	return false
}

// SetTravellerType gets a reference to the given string and assigns it to the TravellerType field.
func (o *Passenger) SetTravellerType(v string) {
	o.TravellerType = &v
}

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

func (o Passenger) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	if !common.IsNil(o.DateOfBirth) {
		toSerialize["dateOfBirth"] = o.DateOfBirth
	}
	if !common.IsNil(o.FirstName) {
		toSerialize["firstName"] = o.FirstName
	}
	if !common.IsNil(o.LastName) {
		toSerialize["lastName"] = o.LastName
	}
	if !common.IsNil(o.PhoneNumber) {
		toSerialize["phoneNumber"] = o.PhoneNumber
	}
	if !common.IsNil(o.TravellerType) {
		toSerialize["travellerType"] = o.TravellerType
	}
	return toSerialize, nil
}

type NullablePassenger struct {
	value *Passenger
	isSet bool
}

func (v NullablePassenger) Get() *Passenger {
	return v.value
}

func (v *NullablePassenger) Set(val *Passenger) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullablePassenger(val *Passenger) *NullablePassenger {
	return &NullablePassenger{value: val, isSet: true}
}

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

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