/*
Legal Entity Management API

API version: 3
*/

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

package legalentity

import (
	"encoding/json"

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

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

// BankAccountInfo struct for BankAccountInfo
type BankAccountInfo struct {
	AccountIdentification *BankAccountInfoAccountIdentification `json:"accountIdentification,omitempty"`
	// The type of bank account.
	// Deprecated since Legal Entity Management API v2
	AccountType *string `json:"accountType,omitempty"`
	// The name of the banking institution where the bank account is held.
	BankName *string `json:"bankName,omitempty"`
	// The two-character [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) country code where the bank account is registered. For example, **NL**.
	CountryCode *string `json:"countryCode,omitempty"`
	// Identifies if the bank account was created through [instant bank verification](https://docs.adyen.com/release-notes/platforms-and-financial-products#releaseNote=2023-05-08-hosted-onboarding).
	TrustedSource *bool `json:"trustedSource,omitempty"`
}

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

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

// GetAccountIdentification returns the AccountIdentification field value if set, zero value otherwise.
func (o *BankAccountInfo) GetAccountIdentification() BankAccountInfoAccountIdentification {
	if o == nil || common.IsNil(o.AccountIdentification) {
		var ret BankAccountInfoAccountIdentification
		return ret
	}
	return *o.AccountIdentification
}

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

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

	return false
}

// SetAccountIdentification gets a reference to the given BankAccountInfoAccountIdentification and assigns it to the AccountIdentification field.
func (o *BankAccountInfo) SetAccountIdentification(v BankAccountInfoAccountIdentification) {
	o.AccountIdentification = &v
}

// GetAccountType returns the AccountType field value if set, zero value otherwise.
// Deprecated since Legal Entity Management API v2
func (o *BankAccountInfo) GetAccountType() string {
	if o == nil || common.IsNil(o.AccountType) {
		var ret string
		return ret
	}
	return *o.AccountType
}

// GetAccountTypeOk returns a tuple with the AccountType field value if set, nil otherwise
// and a boolean to check if the value has been set.
// Deprecated since Legal Entity Management API v2
func (o *BankAccountInfo) GetAccountTypeOk() (*string, bool) {
	if o == nil || common.IsNil(o.AccountType) {
		return nil, false
	}
	return o.AccountType, true
}

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

	return false
}

// SetAccountType gets a reference to the given string and assigns it to the AccountType field.
// Deprecated since Legal Entity Management API v2
func (o *BankAccountInfo) SetAccountType(v string) {
	o.AccountType = &v
}

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

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

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

	return false
}

// SetBankName gets a reference to the given string and assigns it to the BankName field.
func (o *BankAccountInfo) SetBankName(v string) {
	o.BankName = &v
}

// GetCountryCode returns the CountryCode field value if set, zero value otherwise.
func (o *BankAccountInfo) 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 *BankAccountInfo) 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 *BankAccountInfo) 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 *BankAccountInfo) SetCountryCode(v string) {
	o.CountryCode = &v
}

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

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

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

	return false
}

// SetTrustedSource gets a reference to the given bool and assigns it to the TrustedSource field.
func (o *BankAccountInfo) SetTrustedSource(v bool) {
	o.TrustedSource = &v
}

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

func (o BankAccountInfo) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	if !common.IsNil(o.AccountIdentification) {
		toSerialize["accountIdentification"] = o.AccountIdentification
	}
	if !common.IsNil(o.AccountType) {
		toSerialize["accountType"] = o.AccountType
	}
	if !common.IsNil(o.BankName) {
		toSerialize["bankName"] = o.BankName
	}
	if !common.IsNil(o.CountryCode) {
		toSerialize["countryCode"] = o.CountryCode
	}
	if !common.IsNil(o.TrustedSource) {
		toSerialize["trustedSource"] = o.TrustedSource
	}
	return toSerialize, nil
}

type NullableBankAccountInfo struct {
	value *BankAccountInfo
	isSet bool
}

func (v NullableBankAccountInfo) Get() *BankAccountInfo {
	return v.value
}

func (v *NullableBankAccountInfo) Set(val *BankAccountInfo) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableBankAccountInfo(val *BankAccountInfo) *NullableBankAccountInfo {
	return &NullableBankAccountInfo{value: val, isSet: true}
}

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

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