"""cellpointapi.

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

# ruff: noqa: E501
from cellpointapi.api_helper import APIHelper


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

    Card details.

    Attributes:
        cardholder_full_name (str): Full name of the cardholder. As per IEC 7813,
            between 2-26 characters and using the T.50 character set.
        number (str): Payment Card Number (PAN). As per IEC 7813, up to 19 digits.
        expiry_month (str): The month at the end of which the card expires.
        expiry_year (str): The year in which the card expires.
        security_code (str): 3-4 digit [card security
            code](https://en.wikipedia.org/wiki/Card_security_code).  The security
            code may be referred to by different names based on the card and
            acquirer/psp: - "CAV" or "card authentication value": JCB - "CID": "card
            ID", "card identification number", or "card identification code":
            Discover, American Express (four digits on front of card). American
            Express usually uses the four-digit code on the front of the card,
            referred to as the card identification code (CID), but also has a
            three-digit code on the back of the card, referred to as the card
            security code (CSC). American Express also sometimes refers to a "unique
            card code". - "CSC" or "card security code": debit cards,[which?]
            American Express (three digits on back of card, also referred to as 3CSC)
            - "CVC" or "card validation code": Mastercard - "CVD" or "card
            verification data": Discover - "CVE" or "Elo verification code": Elo in
            Brazil - "CVN" or "card validation number": China UnionPay - "CVV" or
            "card verification value": Visa - "SPC" or "signature panel code"
        additional_properties (Dict[str, Any]): The additional properties for the
            model.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "cardholder_full_name": "cardholderFullName",
        "number": "number",
        "expiry_month": "expiryMonth",
        "expiry_year": "expiryYear",
        "security_code": "securityCode",
    }

    def __init__(
        self,
        cardholder_full_name=None,
        number=None,
        expiry_month=None,
        expiry_year=None,
        security_code=None,
        additional_properties=None):
        """Initialize a Card instance."""
        # Initialize members of the class
        self.cardholder_full_name = cardholder_full_name
        self.number = number
        self.expiry_month = expiry_month
        self.expiry_year = expiry_year
        self.security_code = security_code

        # 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
        cardholder_full_name =\
            dictionary.get("cardholderFullName")\
            if dictionary.get("cardholderFullName")\
                else None
        number =\
            dictionary.get("number")\
            if dictionary.get("number")\
                else None
        expiry_month =\
            dictionary.get("expiryMonth")\
            if dictionary.get("expiryMonth")\
                else None
        expiry_year =\
            dictionary.get("expiryYear")\
            if dictionary.get("expiryYear")\
                else None
        security_code =\
            dictionary.get("securityCode")\
            if dictionary.get("securityCode")\
                else None

        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(cardholder_full_name,
                   number,
                   expiry_month,
                   expiry_year,
                   security_code,
                   additional_properties)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _cardholder_full_name=self.cardholder_full_name
        _number=self.number
        _expiry_month=self.expiry_month
        _expiry_year=self.expiry_year
        _security_code=self.security_code
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"cardholder_full_name={_cardholder_full_name!r}, "
            f"number={_number!r}, "
            f"expiry_month={_expiry_month!r}, "
            f"expiry_year={_expiry_year!r}, "
            f"security_code={_security_code!r}, "
            f"additional_properties={_additional_properties!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _cardholder_full_name=self.cardholder_full_name
        _number=self.number
        _expiry_month=self.expiry_month
        _expiry_year=self.expiry_year
        _security_code=self.security_code
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"cardholder_full_name={_cardholder_full_name!s}, "
            f"number={_number!s}, "
            f"expiry_month={_expiry_month!s}, "
            f"expiry_year={_expiry_year!s}, "
            f"security_code={_security_code!s}, "
            f"additional_properties={_additional_properties!s}, "
            f")"
        )
