"""visaacceptancemergedspec.

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

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


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

    Attributes:
        source_account_type (str): Flag that specifies the type of account associated
            with the card.  The cardholder provides this information during the
            payment process.  This field is required in the following cases:   -
            Debit transactions on Cielo and Comercio Latino.   - Transactions with
            Brazilian-issued cards on Visa Acceptance through VisaNet.   - Applicable
            only for Visa Acceptance through VisaNet (CtV).  **Note** Combo cards in
            Brazil contain credit and debit functionality in a single card. Visa
            systems use a credit bank identification number (BIN) for this type of
            card. Using the BIN to determine whether a card is debit or credit can
            cause transactions with these cards to be processed incorrectly. Visa
            Acceptance strongly recommends that you include this field for combo card
            transactions.  Possible values include the following.   - `CH`: Checking
            account  - `CR`: Credit card account  - `SA`: Saving account  - `LI`:
            Line of credit or credit portion of combo card  - `PP`: Prepaid card
            account or prepaid portion of combo card  - `UA`: Universal account  If
            useAs is set to credit/debit and there is a value in SourceAccountType,
            the value in the SourceAccountType field will take precedence. If useAs
            is set to CR/DB and there is a value in SourceAccountType, the value in
            the useAs field will take precedence.
        source_account_type_details (str): Type of account that is being used when
            the value for the override_payment_method field is line of credit (LI) or
            prepaid card (PP). Possible values for line of credit: - `AGRC`: Visa
            Agro Custeio - `AGRE`: Visa Agro Electron - `AGRI`: Visa Agro
            Investimento - `AGRO`: Visa Agro Possible values for prepaid card: -
            `VVA`: Visa Vale Alimentacao - `VVF`: Visa Vale Flex - `VVR`: Visa Vale
            Refeicao This field is supported only for combo card transactions in
            Brazil on Visa Acceptance through VisaNet.
        additional_properties (Dict[str, Any]): The additional properties for the
            model.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "source_account_type": "sourceAccountType",
        "source_account_type_details": "sourceAccountTypeDetails",
    }

    _optionals = [
        "source_account_type",
        "source_account_type_details",
    ]

    def __init__(
        self,
        source_account_type=APIHelper.SKIP,
        source_account_type_details=APIHelper.SKIP,
        additional_properties=None):
        """Initialize a Card3 instance."""
        # Initialize members of the class
        if source_account_type is not APIHelper.SKIP:
            self.source_account_type = source_account_type
        if source_account_type_details is not APIHelper.SKIP:
            self.source_account_type_details = source_account_type_details

        # 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
        source_account_type =\
            dictionary.get("sourceAccountType")\
            if dictionary.get("sourceAccountType")\
                else APIHelper.SKIP
        source_account_type_details =\
            dictionary.get("sourceAccountTypeDetails")\
            if dictionary.get("sourceAccountTypeDetails")\
                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(source_account_type,
                   source_account_type_details,
                   additional_properties)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _source_account_type=(
            self.source_account_type
            if hasattr(self, "source_account_type")
            else None
        )
        _source_account_type_details=(
            self.source_account_type_details
            if hasattr(self, "source_account_type_details")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"source_account_type={_source_account_type!r}, "
            f"source_account_type_details={_source_account_type_details!r}, "
            f"additional_properties={_additional_properties!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _source_account_type=(
            self.source_account_type
            if hasattr(self, "source_account_type")
            else None
        )
        _source_account_type_details=(
            self.source_account_type_details
            if hasattr(self, "source_account_type_details")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"source_account_type={_source_account_type!s}, "
            f"source_account_type_details={_source_account_type_details!s}, "
            f"additional_properties={_additional_properties!s}, "
            f")"
        )
