"""visaacceptancemergedspec.

This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
"""

# ruff: noqa: E501
from visaacceptancemergedspec.api_helper import (
    APIHelper,
)
from visaacceptancemergedspec.models.account_15 import (
    Account15,
)
from visaacceptancemergedspec.models.mandate_1 import (
    Mandate1,
)


class Bank13(object):
    """Implementation of the 'Bank13' model.

    Attributes:
        routing_number (str): Bank routing number. This is also called the transit
            number.
        branch_code (str): Code used to identify the branch of the customer’s bank.
            Required for some countries if you do not or are not allowed to provide
            the IBAN. Use this field only when scoring a direct debit transaction.
        swift_code (str): Bank’s SWIFT code. You can use this field only when scoring
            a direct debit transaction. Required only for crossborder transactions.
        bank_code (str): Country-specific code used to identify the customer’s bank.
            Required for some countries if you do not or are not allowed to provide
            the IBAN instead. You can use this field only when scoring a direct debit
            transaction.
        iban (str): International Bank Account Number (IBAN) for the bank account.
            For some countries you can provide this number instead of the traditional
            bank account information. You can use this field only when scoring a
            direct debit transaction.
        account (Account15): The model property of type Account15.
        mandate (Mandate1): The model property of type Mandate1.
        additional_properties (Dict[str, Any]): The additional properties for the
            model.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "routing_number": "routingNumber",
        "branch_code": "branchCode",
        "swift_code": "swiftCode",
        "bank_code": "bankCode",
        "iban": "iban",
        "account": "account",
        "mandate": "mandate",
    }

    _optionals = [
        "routing_number",
        "branch_code",
        "swift_code",
        "bank_code",
        "iban",
        "account",
        "mandate",
    ]

    def __init__(
        self,
        routing_number=APIHelper.SKIP,
        branch_code=APIHelper.SKIP,
        swift_code=APIHelper.SKIP,
        bank_code=APIHelper.SKIP,
        iban=APIHelper.SKIP,
        account=APIHelper.SKIP,
        mandate=APIHelper.SKIP,
        additional_properties=None):
        """Initialize a Bank13 instance."""
        # Initialize members of the class
        if routing_number is not APIHelper.SKIP:
            self.routing_number = routing_number
        if branch_code is not APIHelper.SKIP:
            self.branch_code = branch_code
        if swift_code is not APIHelper.SKIP:
            self.swift_code = swift_code
        if bank_code is not APIHelper.SKIP:
            self.bank_code = bank_code
        if iban is not APIHelper.SKIP:
            self.iban = iban
        if account is not APIHelper.SKIP:
            self.account = account
        if mandate is not APIHelper.SKIP:
            self.mandate = mandate

        # Add additional model properties to the instance
        if additional_properties is None:
            additional_properties = {}
        self.additional_properties = additional_properties

    @classmethod
    def from_dictionary(cls,
                        dictionary):
        """Create an instance of this model from a dictionary

        Args:
            dictionary (dictionary): A dictionary representation of the object
            as obtained from the deserialization of the server's response. The
            keys MUST match property names in the API description.

        Returns:
            object: An instance of this structure class.

        """
        if not isinstance(dictionary, dict) or dictionary is None:
            return None

        # Extract variables from the dictionary
        routing_number =\
            dictionary.get("routingNumber")\
            if dictionary.get("routingNumber")\
                else APIHelper.SKIP
        branch_code =\
            dictionary.get("branchCode")\
            if dictionary.get("branchCode")\
                else APIHelper.SKIP
        swift_code =\
            dictionary.get("swiftCode")\
            if dictionary.get("swiftCode")\
                else APIHelper.SKIP
        bank_code =\
            dictionary.get("bankCode")\
            if dictionary.get("bankCode")\
                else APIHelper.SKIP
        iban =\
            dictionary.get("iban")\
            if dictionary.get("iban")\
                else APIHelper.SKIP
        account =\
            Account15.from_dictionary(
                dictionary.get("account"))\
                if "account" in dictionary.keys()\
                else APIHelper.SKIP
        mandate =\
            Mandate1.from_dictionary(
                dictionary.get("mandate"))\
                if "mandate" in dictionary.keys()\
                else APIHelper.SKIP

        additional_properties = APIHelper.get_additional_properties(
            dictionary={k: v for k, v in dictionary.items()
                        if k not in cls._names.values()},
            unboxing_function=lambda value: value)

        # Return an object of this model
        return cls(routing_number,
                   branch_code,
                   swift_code,
                   bank_code,
                   iban,
                   account,
                   mandate,
                   additional_properties)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _routing_number=(
            self.routing_number
            if hasattr(self, "routing_number")
            else None
        )
        _branch_code=(
            self.branch_code
            if hasattr(self, "branch_code")
            else None
        )
        _swift_code=(
            self.swift_code
            if hasattr(self, "swift_code")
            else None
        )
        _bank_code=(
            self.bank_code
            if hasattr(self, "bank_code")
            else None
        )
        _iban=(
            self.iban
            if hasattr(self, "iban")
            else None
        )
        _account=(
            self.account
            if hasattr(self, "account")
            else None
        )
        _mandate=(
            self.mandate
            if hasattr(self, "mandate")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"routing_number={_routing_number!r}, "
            f"branch_code={_branch_code!r}, "
            f"swift_code={_swift_code!r}, "
            f"bank_code={_bank_code!r}, "
            f"iban={_iban!r}, "
            f"account={_account!r}, "
            f"mandate={_mandate!r}, "
            f"additional_properties={_additional_properties!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _routing_number=(
            self.routing_number
            if hasattr(self, "routing_number")
            else None
        )
        _branch_code=(
            self.branch_code
            if hasattr(self, "branch_code")
            else None
        )
        _swift_code=(
            self.swift_code
            if hasattr(self, "swift_code")
            else None
        )
        _bank_code=(
            self.bank_code
            if hasattr(self, "bank_code")
            else None
        )
        _iban=(
            self.iban
            if hasattr(self, "iban")
            else None
        )
        _account=(
            self.account
            if hasattr(self, "account")
            else None
        )
        _mandate=(
            self.mandate
            if hasattr(self, "mandate")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"routing_number={_routing_number!s}, "
            f"branch_code={_branch_code!s}, "
            f"swift_code={_swift_code!s}, "
            f"bank_code={_bank_code!s}, "
            f"iban={_iban!s}, "
            f"account={_account!s}, "
            f"mandate={_mandate!s}, "
            f"additional_properties={_additional_properties!s}, "
            f")"
        )
