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

// Configuration struct for Configuration
type Configuration struct {
	// Payment method, like **eftpos_australia** or **mc**. See the [possible values](https://docs.adyen.com/development-resources/paymentmethodvariant#management-api).
	Brand string `json:"brand"`
	// Set to **true** to apply surcharges only to commercial/business cards.
	Commercial *bool `json:"commercial,omitempty"`
	// The country/region of the card issuer. If used, the surcharge settings only apply to the card issued in that country/region.
	Country []string `json:"country,omitempty"`
	// Currency and percentage or amount of the surcharge.
	Currencies []Currency `json:"currencies"`
	// Funding source. Possible values: * **Credit** * **Debit**
	Sources []string `json:"sources,omitempty"`
}

// NewConfiguration instantiates a new Configuration 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 NewConfiguration(brand string, currencies []Currency) *Configuration {
	this := Configuration{}
	this.Brand = brand
	this.Currencies = currencies
	return &this
}

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

// GetBrand returns the Brand field value
func (o *Configuration) GetBrand() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.Brand
}

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

// SetBrand sets field value
func (o *Configuration) SetBrand(v string) {
	o.Brand = v
}

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

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

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

	return false
}

// SetCommercial gets a reference to the given bool and assigns it to the Commercial field.
func (o *Configuration) SetCommercial(v bool) {
	o.Commercial = &v
}

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

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

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

	return false
}

// SetCountry gets a reference to the given []string and assigns it to the Country field.
func (o *Configuration) SetCountry(v []string) {
	o.Country = v
}

// GetCurrencies returns the Currencies field value
func (o *Configuration) GetCurrencies() []Currency {
	if o == nil {
		var ret []Currency
		return ret
	}

	return o.Currencies
}

// GetCurrenciesOk returns a tuple with the Currencies field value
// and a boolean to check if the value has been set.
func (o *Configuration) GetCurrenciesOk() ([]Currency, bool) {
	if o == nil {
		return nil, false
	}
	return o.Currencies, true
}

// SetCurrencies sets field value
func (o *Configuration) SetCurrencies(v []Currency) {
	o.Currencies = v
}

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

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

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

	return false
}

// SetSources gets a reference to the given []string and assigns it to the Sources field.
func (o *Configuration) SetSources(v []string) {
	o.Sources = v
}

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

func (o Configuration) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	toSerialize["brand"] = o.Brand
	if !common.IsNil(o.Commercial) {
		toSerialize["commercial"] = o.Commercial
	}
	if !common.IsNil(o.Country) {
		toSerialize["country"] = o.Country
	}
	toSerialize["currencies"] = o.Currencies
	if !common.IsNil(o.Sources) {
		toSerialize["sources"] = o.Sources
	}
	return toSerialize, nil
}

type NullableConfiguration struct {
	value *Configuration
	isSet bool
}

func (v NullableConfiguration) Get() *Configuration {
	return v.value
}

func (v *NullableConfiguration) Set(val *Configuration) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableConfiguration(val *Configuration) *NullableConfiguration {
	return &NullableConfiguration{value: val, isSet: true}
}

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

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