"""visaacceptancemergedspec.

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

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


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

    Attributes:
        account_type (str): Type of account.  This value is returned only if you
            request a balance inquiry.  Possible values:   - `00`: Not applicable or
            not specified  - `10`: Savings account  - `20`: Checking account  - `30`:
            Credit card account  - `40`: Universal account  Balance Account Types
            returned on EBT Debit card transactions:   - `96`: Cash Benefits Account
            (PIN Debit Gateway EBT only)  - `98`: Food Stamp Account (PIN Debit
            Gateway EBT only)
        amount (str): Remaining balance on the account. If the processor returns the
            sign, positive or negative, this sign is prefixed to the amount value as
            (+/-).
        amount_type (str): Type of amount. This value is returned only if you request
            a balance inquiry. The issuer determines the value that is returned.
            Possible values for deposit accounts:   - `01`: Current ledger (posted)
            balance.  - `02`: Current available balance, which is typically the
            ledger balance minus outstanding authorizations. Some  depository
            institutions also include pending deposits and the credit or overdraft
            line associated with the account.  Possible values for credit card
            accounts:   - `01`: Credit amount remaining for customer (open to buy).
            - `02`: Credit limit.
        currency (str): Currency of the remaining balance on the 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_type": "accountType",
        "amount": "amount",
        "amount_type": "amountType",
        "currency": "currency",
    }

    _optionals = [
        "account_type",
        "amount",
        "amount_type",
        "currency",
    ]

    def __init__(
        self,
        account_type=APIHelper.SKIP,
        amount=APIHelper.SKIP,
        amount_type=APIHelper.SKIP,
        currency=APIHelper.SKIP,
        additional_properties=None):
        """Initialize a Balance instance."""
        # Initialize members of the class
        if account_type is not APIHelper.SKIP:
            self.account_type = account_type
        if amount is not APIHelper.SKIP:
            self.amount = amount
        if amount_type is not APIHelper.SKIP:
            self.amount_type = amount_type
        if currency is not APIHelper.SKIP:
            self.currency = currency

        # 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_type =\
            dictionary.get("accountType")\
            if dictionary.get("accountType")\
                else APIHelper.SKIP
        amount =\
            dictionary.get("amount")\
            if dictionary.get("amount")\
                else APIHelper.SKIP
        amount_type =\
            dictionary.get("amountType")\
            if dictionary.get("amountType")\
                else APIHelper.SKIP
        currency =\
            dictionary.get("currency")\
            if dictionary.get("currency")\
                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_type,
                   amount,
                   amount_type,
                   currency,
                   additional_properties)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _account_type=(
            self.account_type
            if hasattr(self, "account_type")
            else None
        )
        _amount=(
            self.amount
            if hasattr(self, "amount")
            else None
        )
        _amount_type=(
            self.amount_type
            if hasattr(self, "amount_type")
            else None
        )
        _currency=(
            self.currency
            if hasattr(self, "currency")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"account_type={_account_type!r}, "
            f"amount={_amount!r}, "
            f"amount_type={_amount_type!r}, "
            f"currency={_currency!r}, "
            f"additional_properties={_additional_properties!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _account_type=(
            self.account_type
            if hasattr(self, "account_type")
            else None
        )
        _amount=(
            self.amount
            if hasattr(self, "amount")
            else None
        )
        _amount_type=(
            self.amount_type
            if hasattr(self, "amount_type")
            else None
        )
        _currency=(
            self.currency
            if hasattr(self, "currency")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"account_type={_account_type!s}, "
            f"amount={_amount!s}, "
            f"amount_type={_amount_type!s}, "
            f"currency={_currency!s}, "
            f"additional_properties={_additional_properties!s}, "
            f")"
        )
