"""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.tokenized_information import (
    TokenizedInformation,
)


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

    Attributes:
        expiration_month (str): Two-digit month in which the payment card expires.
            Format: `MM`.  Possible Values: `01` through `12`.
        expiration_year (str): Four-digit year in which the credit card expires.
            Format: `YYYY`.
        mtype (str): Value that indicates the card type. Possible Values v2 : v1:   *
            001 : visa   * 002 : mastercard - Eurocard—European regional brand of
            Mastercard   * 003 : american express   * 004 : discover   * 005 : diners
            club   * 006 : carte blanche   * 007 : jcb   * 008 : optima   * 011 :
            twinpay credit   * 012 : twinpay debit   * 013 : walmart   * 014 :
            enRoute   * 015 : lowes consumer   * 016 : home depot consumer   * 017 :
            mbna   * 018 : dicks sportswear   * 019 : casual corner   * 020 : sears
            * 021 : jal   * 023 : disney   * 024 : maestro uk domestic   * 025 : sams
            club consumer   * 026 : sams club business   * 028 : bill me later   *
            029 : bebe   * 030 : restoration hardware   * 031 : delta online — use
            this value only for Ingenico ePayments. For other processors, use 001 for
            all Visa card types.   * 032 : solo   * 033 : visa electron   * 034 :
            dankort   * 035 : laser   * 036 : carte bleue — formerly Cartes Bancaires
            * 037 : carta si   * 038 : pinless debit   * 039 : encoded account   *
            040 : uatp   * 041 : household   * 042 : maestro international   * 043 :
            ge money uk   * 044 : korean cards   * 045 : style   * 046 : jcrew   *
            047 : payease china processing ewallet   * 048 : payease china processing
            bank transfer   * 049 : meijer private label   * 050 : hipercard —
            supported only by the Comercio Latino processor.   * 051 : aura —
            supported only by the Comercio Latino processor.   * 052 : redecard   *
            054 : elo — supported only by the Comercio Latino processor.   * 055 :
            capital one private label   * 056 : synchrony private label   * 057 :
            costco private label   * 060 : mada   * 062 : china union pay   * 063 :
            falabella private label
        issue_number (str): Number of times a Maestro (UK Domestic) card has been
            issued to the account holder. The card might or might not have an issue
            number. The number can consist of one or two digits, and the first digit
            might be a zero. When you include this value in your request, include
            exactly what is printed on the card. A value of 2 is different than a
            value of 02. Do not include the field, even with a blank value, if the
            card is not a Maestro (UK Domestic) card.  **Note** The issue number is
            not required for Maestro (UK Domestic) transactions.
        start_month (str): Month of the start of the Maestro (UK Domestic) card
            validity period. Do not include the field, even with a blank value, if
            the card is not a Maestro (UK Domestic) card. `Format: MM`. Possible
            Values: 01 through 12.  **Note** The start date is not required for
            Maestro (UK Domestic) transactions.
        start_year (str): Year of the start of the Maestro (UK Domestic) card
            validity period. Do not include the field, even with a blank value, if
            the card is not a Maestro (UK Domestic) card. `Format: YYYY`.  **Note**
            The start date is not required for Maestro (UK Domestic) transactions.
        use_as (str): 'Payment Instrument was created / updated as part of a pinless
            debit transaction.'
        hash (str): Hash value representing the card.
        tokenized_information (TokenizedInformation): The model property of type
            TokenizedInformation.
        additional_properties (Dict[str, Any]): The additional properties for the
            model.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "expiration_month": "expirationMonth",
        "expiration_year": "expirationYear",
        "mtype": "type",
        "issue_number": "issueNumber",
        "start_month": "startMonth",
        "start_year": "startYear",
        "use_as": "useAs",
        "hash": "hash",
        "tokenized_information": "tokenizedInformation",
    }

    _optionals = [
        "expiration_month",
        "expiration_year",
        "mtype",
        "issue_number",
        "start_month",
        "start_year",
        "use_as",
        "hash",
        "tokenized_information",
    ]

    def __init__(
        self,
        expiration_month=APIHelper.SKIP,
        expiration_year=APIHelper.SKIP,
        mtype=APIHelper.SKIP,
        issue_number=APIHelper.SKIP,
        start_month=APIHelper.SKIP,
        start_year=APIHelper.SKIP,
        use_as=APIHelper.SKIP,
        hash=APIHelper.SKIP,
        tokenized_information=APIHelper.SKIP,
        additional_properties=None):
        """Initialize a Card12 instance."""
        # Initialize members of the class
        if expiration_month is not APIHelper.SKIP:
            self.expiration_month = expiration_month
        if expiration_year is not APIHelper.SKIP:
            self.expiration_year = expiration_year
        if mtype is not APIHelper.SKIP:
            self.mtype = mtype
        if issue_number is not APIHelper.SKIP:
            self.issue_number = issue_number
        if start_month is not APIHelper.SKIP:
            self.start_month = start_month
        if start_year is not APIHelper.SKIP:
            self.start_year = start_year
        if use_as is not APIHelper.SKIP:
            self.use_as = use_as
        if hash is not APIHelper.SKIP:
            self.hash = hash
        if tokenized_information is not APIHelper.SKIP:
            self.tokenized_information = tokenized_information

        # 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
        expiration_month =\
            dictionary.get("expirationMonth")\
            if dictionary.get("expirationMonth")\
                else APIHelper.SKIP
        expiration_year =\
            dictionary.get("expirationYear")\
            if dictionary.get("expirationYear")\
                else APIHelper.SKIP
        mtype =\
            dictionary.get("type")\
            if dictionary.get("type")\
                else APIHelper.SKIP
        issue_number =\
            dictionary.get("issueNumber")\
            if dictionary.get("issueNumber")\
                else APIHelper.SKIP
        start_month =\
            dictionary.get("startMonth")\
            if dictionary.get("startMonth")\
                else APIHelper.SKIP
        start_year =\
            dictionary.get("startYear")\
            if dictionary.get("startYear")\
                else APIHelper.SKIP
        use_as =\
            dictionary.get("useAs")\
            if dictionary.get("useAs")\
                else APIHelper.SKIP
        hash =\
            dictionary.get("hash")\
            if dictionary.get("hash")\
                else APIHelper.SKIP
        tokenized_information =\
            TokenizedInformation.from_dictionary(
                dictionary.get("tokenizedInformation"))\
                if "tokenizedInformation" in dictionary.keys()\
                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(expiration_month,
                   expiration_year,
                   mtype,
                   issue_number,
                   start_month,
                   start_year,
                   use_as,
                   hash,
                   tokenized_information,
                   additional_properties)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _expiration_month=(
            self.expiration_month
            if hasattr(self, "expiration_month")
            else None
        )
        _expiration_year=(
            self.expiration_year
            if hasattr(self, "expiration_year")
            else None
        )
        _mtype=(
            self.mtype
            if hasattr(self, "mtype")
            else None
        )
        _issue_number=(
            self.issue_number
            if hasattr(self, "issue_number")
            else None
        )
        _start_month=(
            self.start_month
            if hasattr(self, "start_month")
            else None
        )
        _start_year=(
            self.start_year
            if hasattr(self, "start_year")
            else None
        )
        _use_as=(
            self.use_as
            if hasattr(self, "use_as")
            else None
        )
        _hash=(
            self.hash
            if hasattr(self, "hash")
            else None
        )
        _tokenized_information=(
            self.tokenized_information
            if hasattr(self, "tokenized_information")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"expiration_month={_expiration_month!r}, "
            f"expiration_year={_expiration_year!r}, "
            f"mtype={_mtype!r}, "
            f"issue_number={_issue_number!r}, "
            f"start_month={_start_month!r}, "
            f"start_year={_start_year!r}, "
            f"use_as={_use_as!r}, "
            f"hash={_hash!r}, "
            f"tokenized_information={_tokenized_information!r}, "
            f"additional_properties={_additional_properties!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _expiration_month=(
            self.expiration_month
            if hasattr(self, "expiration_month")
            else None
        )
        _expiration_year=(
            self.expiration_year
            if hasattr(self, "expiration_year")
            else None
        )
        _mtype=(
            self.mtype
            if hasattr(self, "mtype")
            else None
        )
        _issue_number=(
            self.issue_number
            if hasattr(self, "issue_number")
            else None
        )
        _start_month=(
            self.start_month
            if hasattr(self, "start_month")
            else None
        )
        _start_year=(
            self.start_year
            if hasattr(self, "start_year")
            else None
        )
        _use_as=(
            self.use_as
            if hasattr(self, "use_as")
            else None
        )
        _hash=(
            self.hash
            if hasattr(self, "hash")
            else None
        )
        _tokenized_information=(
            self.tokenized_information
            if hasattr(self, "tokenized_information")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"expiration_month={_expiration_month!s}, "
            f"expiration_year={_expiration_year!s}, "
            f"mtype={_mtype!s}, "
            f"issue_number={_issue_number!s}, "
            f"start_month={_start_month!s}, "
            f"start_year={_start_year!s}, "
            f"use_as={_use_as!s}, "
            f"hash={_hash!s}, "
            f"tokenized_information={_tokenized_information!s}, "
            f"additional_properties={_additional_properties!s}, "
            f")"
        )
