/*
Adyen BinLookup API

API version: 54
*/

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

package binlookup

import (
	"encoding/json"

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

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

// MerchantDetails struct for MerchantDetails
type MerchantDetails struct {
	// 2-letter ISO 3166 country code of the card acceptor location. > This parameter is required for the merchants who don't use Adyen as the payment authorisation gateway.
	CountryCode *string `json:"countryCode,omitempty"`
	// If true, indicates that the merchant is enrolled in 3D Secure for the card network.
	EnrolledIn3DSecure *bool `json:"enrolledIn3DSecure,omitempty"`
	// The merchant category code (MCC) is a four-digit number which relates to a particular market segment. This code reflects the predominant activity that is conducted by the merchant.  The list of MCCs can be found [here](https://en.wikipedia.org/wiki/Merchant_category_code).
	Mcc *string `json:"mcc,omitempty"`
}

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

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

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

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

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

	return false
}

// SetCountryCode gets a reference to the given string and assigns it to the CountryCode field.
func (o *MerchantDetails) SetCountryCode(v string) {
	o.CountryCode = &v
}

// GetEnrolledIn3DSecure returns the EnrolledIn3DSecure field value if set, zero value otherwise.
func (o *MerchantDetails) GetEnrolledIn3DSecure() bool {
	if o == nil || common.IsNil(o.EnrolledIn3DSecure) {
		var ret bool
		return ret
	}
	return *o.EnrolledIn3DSecure
}

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

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

	return false
}

// SetEnrolledIn3DSecure gets a reference to the given bool and assigns it to the EnrolledIn3DSecure field.
func (o *MerchantDetails) SetEnrolledIn3DSecure(v bool) {
	o.EnrolledIn3DSecure = &v
}

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

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

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

	return false
}

// SetMcc gets a reference to the given string and assigns it to the Mcc field.
func (o *MerchantDetails) SetMcc(v string) {
	o.Mcc = &v
}

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

func (o MerchantDetails) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	if !common.IsNil(o.CountryCode) {
		toSerialize["countryCode"] = o.CountryCode
	}
	if !common.IsNil(o.EnrolledIn3DSecure) {
		toSerialize["enrolledIn3DSecure"] = o.EnrolledIn3DSecure
	}
	if !common.IsNil(o.Mcc) {
		toSerialize["mcc"] = o.Mcc
	}
	return toSerialize, nil
}

type NullableMerchantDetails struct {
	value *MerchantDetails
	isSet bool
}

func (v NullableMerchantDetails) Get() *MerchantDetails {
	return v.value
}

func (v *NullableMerchantDetails) Set(val *MerchantDetails) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableMerchantDetails(val *MerchantDetails) *NullableMerchantDetails {
	return &NullableMerchantDetails{value: val, isSet: true}
}

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

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