"""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 import (
    Account,
)


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

    Attributes:
        account (Account): The model property of type Account.
        routing_number (str): Bank routing number. This is also called the _transit
            number_.
        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.
        swift_code (str): Bank’s SWIFT code. You can use this field only when scoring
            a direct debit transaction. Required only for crossborder transactions.
        code (str): Bank code of the consumer’s account
        additional_properties (Dict[str, Any]): The additional properties for the
            model.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "account": "account",
        "routing_number": "routingNumber",
        "iban": "iban",
        "swift_code": "swiftCode",
        "code": "code",
    }

    _optionals = [
        "account",
        "routing_number",
        "iban",
        "swift_code",
        "code",
    ]

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

        # 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
        account =\
            Account.from_dictionary(
                dictionary.get("account"))\
                if "account" in dictionary.keys()\
                else APIHelper.SKIP
        routing_number =\
            dictionary.get("routingNumber")\
            if dictionary.get("routingNumber")\
                else APIHelper.SKIP
        iban =\
            dictionary.get("iban")\
            if dictionary.get("iban")\
                else APIHelper.SKIP
        swift_code =\
            dictionary.get("swiftCode")\
            if dictionary.get("swiftCode")\
                else APIHelper.SKIP
        code =\
            dictionary.get("code")\
            if dictionary.get("code")\
                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(account,
                   routing_number,
                   iban,
                   swift_code,
                   code,
                   additional_properties)

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

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