"""visaacceptancemergedspec.

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

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


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

    Attributes:
        number (str): The customer’s payment card number, also known as the Primary
            Account Number (PAN).
        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): The type of card (Card Network). Possible Values: - 001: visa
        suffix (str): The customer’s latest payment card number suffix.
        additional_properties (Dict[str, Any]): The additional properties for the
            model.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "number": "number",
        "expiration_month": "expirationMonth",
        "expiration_year": "expirationYear",
        "mtype": "type",
        "suffix": "suffix",
    }

    _optionals = [
        "number",
        "expiration_month",
        "expiration_year",
        "mtype",
        "suffix",
    ]

    def __init__(
        self,
        number=APIHelper.SKIP,
        expiration_month=APIHelper.SKIP,
        expiration_year=APIHelper.SKIP,
        mtype=APIHelper.SKIP,
        suffix=APIHelper.SKIP,
        additional_properties=None):
        """Initialize a Card5 instance."""
        # Initialize members of the class
        if number is not APIHelper.SKIP:
            self.number = number
        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 suffix is not APIHelper.SKIP:
            self.suffix = suffix

        # 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
        number =\
            dictionary.get("number")\
            if dictionary.get("number")\
                else APIHelper.SKIP
        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
        suffix =\
            dictionary.get("suffix")\
            if dictionary.get("suffix")\
                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(number,
                   expiration_month,
                   expiration_year,
                   mtype,
                   suffix,
                   additional_properties)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _number=(
            self.number
            if hasattr(self, "number")
            else None
        )
        _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
        )
        _suffix=(
            self.suffix
            if hasattr(self, "suffix")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"number={_number!r}, "
            f"expiration_month={_expiration_month!r}, "
            f"expiration_year={_expiration_year!r}, "
            f"mtype={_mtype!r}, "
            f"suffix={_suffix!r}, "
            f"additional_properties={_additional_properties!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _number=(
            self.number
            if hasattr(self, "number")
            else None
        )
        _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
        )
        _suffix=(
            self.suffix
            if hasattr(self, "suffix")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"number={_number!s}, "
            f"expiration_month={_expiration_month!s}, "
            f"expiration_year={_expiration_year!s}, "
            f"mtype={_mtype!s}, "
            f"suffix={_suffix!s}, "
            f"additional_properties={_additional_properties!s}, "
            f")"
        )
