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

// MerchantPurchaseData struct for MerchantPurchaseData
type MerchantPurchaseData struct {
	Airline *Airline `json:"airline,omitempty"`
	// Lodging information.
	Lodging []Lodging `json:"lodging,omitempty"`
	// The type of events data.   Possible values:    - **merchantPurchaseData**: merchant purchase data
	Type string `json:"type"`
}

// NewMerchantPurchaseData instantiates a new MerchantPurchaseData 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 NewMerchantPurchaseData(type_ string) *MerchantPurchaseData {
	this := MerchantPurchaseData{}
	this.Type = type_
	return &this
}

// NewMerchantPurchaseDataWithDefaults instantiates a new MerchantPurchaseData 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 NewMerchantPurchaseDataWithDefaults() *MerchantPurchaseData {
	this := MerchantPurchaseData{}
	var type_ string = "merchantPurchaseData"
	this.Type = type_
	return &this
}

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

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

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

	return false
}

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

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

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

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

	return false
}

// SetLodging gets a reference to the given []Lodging and assigns it to the Lodging field.
func (o *MerchantPurchaseData) SetLodging(v []Lodging) {
	o.Lodging = v
}

// GetType returns the Type field value
func (o *MerchantPurchaseData) GetType() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.Type
}

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

// SetType sets field value
func (o *MerchantPurchaseData) SetType(v string) {
	o.Type = v
}

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

func (o MerchantPurchaseData) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	if !common.IsNil(o.Airline) {
		toSerialize["airline"] = o.Airline
	}
	if !common.IsNil(o.Lodging) {
		toSerialize["lodging"] = o.Lodging
	}
	toSerialize["type"] = o.Type
	return toSerialize, nil
}

type NullableMerchantPurchaseData struct {
	value *MerchantPurchaseData
	isSet bool
}

func (v NullableMerchantPurchaseData) Get() *MerchantPurchaseData {
	return v.value
}

func (v *NullableMerchantPurchaseData) Set(val *MerchantPurchaseData) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableMerchantPurchaseData(val *MerchantPurchaseData) *NullableMerchantPurchaseData {
	return &NullableMerchantPurchaseData{value: val, isSet: true}
}

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

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

func (o *MerchantPurchaseData) isValidType() bool {
	var allowedEnumValues = []string{"merchantPurchaseData"}
	for _, allowed := range allowedEnumValues {
		if o.GetType() == allowed {
			return true
		}
	}
	return false
}
