"""visaacceptancemergedspec.

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

# ruff: noqa: E501
from visaacceptancemergedspec.api_helper import (
    APIHelper,
)


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

    Attributes:
        suffix (str): Last four digits of the customer’s payment account number.
        prefix (str): Bank Identification Number (BIN). This is the initial four to
            six numbers on a credit card account number.
        check_number (str): Check number.  Chase Paymentech Solutions - Optional.
            Visa Acceptance ACH Service - Not used. RBS WorldPay Atlanta - Optional
            on debits. Required on credits. TeleCheck - Strongly recommended on debit
            requests. Optional on credits.
        mtype (str): Account type.  Possible values:  - **C**: Checking.  - **G**:
            General ledger. This value is supported only on Wells Fargo ACH.  -
            **S**: Savings (U.S. dollars only).  - **X**: Corporate checking (U.S.
            dollars only).
        name (str): Name used on the bank account. You can use this field only when
            scoring a direct debit transaction
        check_digit (str): Code used to validate the customer’s account number.
            Required for some countries if you do not or are not allowed to provide
            the IBAN instead. You may use this field only when scoring a direct debit
            transaction.
        encoder_id (str): Identifier for the bank that provided the customer’s
            encoded account number.  To obtain the bank identifier, contact your
            processor.
        additional_properties (Dict[str, Any]): The additional properties for the
            model.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "suffix": "suffix",
        "prefix": "prefix",
        "check_number": "checkNumber",
        "mtype": "type",
        "name": "name",
        "check_digit": "checkDigit",
        "encoder_id": "encoderId",
    }

    _optionals = [
        "suffix",
        "prefix",
        "check_number",
        "mtype",
        "name",
        "check_digit",
        "encoder_id",
    ]

    def __init__(
        self,
        suffix=APIHelper.SKIP,
        prefix=APIHelper.SKIP,
        check_number=APIHelper.SKIP,
        mtype=APIHelper.SKIP,
        name=APIHelper.SKIP,
        check_digit=APIHelper.SKIP,
        encoder_id=APIHelper.SKIP,
        additional_properties=None):
        """Initialize a Account15 instance."""
        # Initialize members of the class
        if suffix is not APIHelper.SKIP:
            self.suffix = suffix
        if prefix is not APIHelper.SKIP:
            self.prefix = prefix
        if check_number is not APIHelper.SKIP:
            self.check_number = check_number
        if mtype is not APIHelper.SKIP:
            self.mtype = mtype
        if name is not APIHelper.SKIP:
            self.name = name
        if check_digit is not APIHelper.SKIP:
            self.check_digit = check_digit
        if encoder_id is not APIHelper.SKIP:
            self.encoder_id = encoder_id

        # 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
        suffix =\
            dictionary.get("suffix")\
            if dictionary.get("suffix")\
                else APIHelper.SKIP
        prefix =\
            dictionary.get("prefix")\
            if dictionary.get("prefix")\
                else APIHelper.SKIP
        check_number =\
            dictionary.get("checkNumber")\
            if dictionary.get("checkNumber")\
                else APIHelper.SKIP
        mtype =\
            dictionary.get("type")\
            if dictionary.get("type")\
                else APIHelper.SKIP
        name =\
            dictionary.get("name")\
            if dictionary.get("name")\
                else APIHelper.SKIP
        check_digit =\
            dictionary.get("checkDigit")\
            if dictionary.get("checkDigit")\
                else APIHelper.SKIP
        encoder_id =\
            dictionary.get("encoderId")\
            if dictionary.get("encoderId")\
                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(suffix,
                   prefix,
                   check_number,
                   mtype,
                   name,
                   check_digit,
                   encoder_id,
                   additional_properties)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _suffix=(
            self.suffix
            if hasattr(self, "suffix")
            else None
        )
        _prefix=(
            self.prefix
            if hasattr(self, "prefix")
            else None
        )
        _check_number=(
            self.check_number
            if hasattr(self, "check_number")
            else None
        )
        _mtype=(
            self.mtype
            if hasattr(self, "mtype")
            else None
        )
        _name=(
            self.name
            if hasattr(self, "name")
            else None
        )
        _check_digit=(
            self.check_digit
            if hasattr(self, "check_digit")
            else None
        )
        _encoder_id=(
            self.encoder_id
            if hasattr(self, "encoder_id")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"suffix={_suffix!r}, "
            f"prefix={_prefix!r}, "
            f"check_number={_check_number!r}, "
            f"mtype={_mtype!r}, "
            f"name={_name!r}, "
            f"check_digit={_check_digit!r}, "
            f"encoder_id={_encoder_id!r}, "
            f"additional_properties={_additional_properties!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _suffix=(
            self.suffix
            if hasattr(self, "suffix")
            else None
        )
        _prefix=(
            self.prefix
            if hasattr(self, "prefix")
            else None
        )
        _check_number=(
            self.check_number
            if hasattr(self, "check_number")
            else None
        )
        _mtype=(
            self.mtype
            if hasattr(self, "mtype")
            else None
        )
        _name=(
            self.name
            if hasattr(self, "name")
            else None
        )
        _check_digit=(
            self.check_digit
            if hasattr(self, "check_digit")
            else None
        )
        _encoder_id=(
            self.encoder_id
            if hasattr(self, "encoder_id")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"suffix={_suffix!s}, "
            f"prefix={_prefix!s}, "
            f"check_number={_check_number!s}, "
            f"mtype={_mtype!s}, "
            f"name={_name!s}, "
            f"check_digit={_check_digit!s}, "
            f"encoder_id={_encoder_id!s}, "
            f"additional_properties={_additional_properties!s}, "
            f")"
        )
