"""visaacceptancemergedspec.

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

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


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

    Attributes:
        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).
        number (str): Account number.  When processing encoded account numbers, use
            this field for the encoded account number.
        encoder_id (str): Identifier for the bank that provided the customer’s
            encoded account number.  To obtain the bank identifier, contact your
            processor.
        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.
        check_image_reference_number (str): Image reference number associated with
            the check. You cannot include any special characters.
        additional_properties (Dict[str, Any]): The additional properties for the
            model.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "mtype": "type",
        "number": "number",
        "encoder_id": "encoderId",
        "check_number": "checkNumber",
        "check_image_reference_number": "checkImageReferenceNumber",
    }

    _optionals = [
        "mtype",
        "number",
        "encoder_id",
        "check_number",
        "check_image_reference_number",
    ]

    def __init__(
        self,
        mtype=APIHelper.SKIP,
        number=APIHelper.SKIP,
        encoder_id=APIHelper.SKIP,
        check_number=APIHelper.SKIP,
        check_image_reference_number=APIHelper.SKIP,
        additional_properties=None):
        """Initialize a Account3 instance."""
        # Initialize members of the class
        if mtype is not APIHelper.SKIP:
            self.mtype = mtype
        if number is not APIHelper.SKIP:
            self.number = number
        if encoder_id is not APIHelper.SKIP:
            self.encoder_id = encoder_id
        if check_number is not APIHelper.SKIP:
            self.check_number = check_number
        if check_image_reference_number is not APIHelper.SKIP:
            self.check_image_reference_number = check_image_reference_number

        # 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
        mtype =\
            dictionary.get("type")\
            if dictionary.get("type")\
                else APIHelper.SKIP
        number =\
            dictionary.get("number")\
            if dictionary.get("number")\
                else APIHelper.SKIP
        encoder_id =\
            dictionary.get("encoderId")\
            if dictionary.get("encoderId")\
                else APIHelper.SKIP
        check_number =\
            dictionary.get("checkNumber")\
            if dictionary.get("checkNumber")\
                else APIHelper.SKIP
        check_image_reference_number =\
            dictionary.get("checkImageReferenceNumber")\
            if dictionary.get("checkImageReferenceNumber")\
                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(mtype,
                   number,
                   encoder_id,
                   check_number,
                   check_image_reference_number,
                   additional_properties)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _mtype=(
            self.mtype
            if hasattr(self, "mtype")
            else None
        )
        _number=(
            self.number
            if hasattr(self, "number")
            else None
        )
        _encoder_id=(
            self.encoder_id
            if hasattr(self, "encoder_id")
            else None
        )
        _check_number=(
            self.check_number
            if hasattr(self, "check_number")
            else None
        )
        _check_image_reference_number=(
            self.check_image_reference_number
            if hasattr(self, "check_image_reference_number")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"mtype={_mtype!r}, "
            f"number={_number!r}, "
            f"encoder_id={_encoder_id!r}, "
            f"check_number={_check_number!r}, "
            f"check_image_reference_number={_check_image_reference_number!r}, "
            f"additional_properties={_additional_properties!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _mtype=(
            self.mtype
            if hasattr(self, "mtype")
            else None
        )
        _number=(
            self.number
            if hasattr(self, "number")
            else None
        )
        _encoder_id=(
            self.encoder_id
            if hasattr(self, "encoder_id")
            else None
        )
        _check_number=(
            self.check_number
            if hasattr(self, "check_number")
            else None
        )
        _check_image_reference_number=(
            self.check_image_reference_number
            if hasattr(self, "check_image_reference_number")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"mtype={_mtype!s}, "
            f"number={_number!s}, "
            f"encoder_id={_encoder_id!s}, "
            f"check_number={_check_number!s}, "
            f"check_image_reference_number={_check_image_reference_number!s}, "
            f"additional_properties={_additional_properties!s}, "
            f")"
        )
