/*
Management API

API version: 3
*/

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

package management

import (
	"encoding/json"

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

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

// PayToInfo struct for PayToInfo
type PayToInfo struct {
	// Merchant name displayed to the shopper in the Agreements
	MerchantName string `json:"merchantName"`
	// Represents the purpose of the Agreements created, it relates to the business type **Allowed values**: mortgage, utility, loan, gambling, retail, salary, personal, government, pension, tax, other
	PayToPurpose string `json:"payToPurpose"`
}

// NewPayToInfo instantiates a new PayToInfo 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 NewPayToInfo(merchantName string, payToPurpose string) *PayToInfo {
	this := PayToInfo{}
	this.MerchantName = merchantName
	this.PayToPurpose = payToPurpose
	return &this
}

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

// GetMerchantName returns the MerchantName field value
func (o *PayToInfo) GetMerchantName() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.MerchantName
}

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

// SetMerchantName sets field value
func (o *PayToInfo) SetMerchantName(v string) {
	o.MerchantName = v
}

// GetPayToPurpose returns the PayToPurpose field value
func (o *PayToInfo) GetPayToPurpose() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.PayToPurpose
}

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

// SetPayToPurpose sets field value
func (o *PayToInfo) SetPayToPurpose(v string) {
	o.PayToPurpose = v
}

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

func (o PayToInfo) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	toSerialize["merchantName"] = o.MerchantName
	toSerialize["payToPurpose"] = o.PayToPurpose
	return toSerialize, nil
}

type NullablePayToInfo struct {
	value *PayToInfo
	isSet bool
}

func (v NullablePayToInfo) Get() *PayToInfo {
	return v.value
}

func (v *NullablePayToInfo) Set(val *PayToInfo) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullablePayToInfo(val *PayToInfo) *NullablePayToInfo {
	return &NullablePayToInfo{value: val, isSet: true}
}

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

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