"""mindbodypublicapi.

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

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


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

    Information about an individual credit card

    Attributes:
        credit_card_number (str): The model property of type str.
        exp_month (str): The model property of type str.
        exp_year (str): The model property of type str.
        billing_name (str): The model property of type str.
        billing_address (str): The model property of type str.
        billing_city (str): The model property of type str.
        billing_state (str): The model property of type str.
        billing_postal_code (str): The model property of type str.
        save_info (bool): The model property of type bool.
        card_id (str): Card Id of a stored instruments card
        cvv (str): CVV of the card

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "credit_card_number": "CreditCardNumber",
        "exp_month": "ExpMonth",
        "exp_year": "ExpYear",
        "billing_name": "BillingName",
        "billing_address": "BillingAddress",
        "billing_city": "BillingCity",
        "billing_state": "BillingState",
        "billing_postal_code": "BillingPostalCode",
        "save_info": "SaveInfo",
        "card_id": "CardId",
        "cvv": "CVV",
    }

    _optionals = [
        "credit_card_number",
        "exp_month",
        "exp_year",
        "billing_name",
        "billing_address",
        "billing_city",
        "billing_state",
        "billing_postal_code",
        "save_info",
        "card_id",
        "cvv",
    ]

    def __init__(
        self,
        credit_card_number=APIHelper.SKIP,
        exp_month=APIHelper.SKIP,
        exp_year=APIHelper.SKIP,
        billing_name=APIHelper.SKIP,
        billing_address=APIHelper.SKIP,
        billing_city=APIHelper.SKIP,
        billing_state=APIHelper.SKIP,
        billing_postal_code=APIHelper.SKIP,
        save_info=APIHelper.SKIP,
        card_id=APIHelper.SKIP,
        cvv=APIHelper.SKIP):
        """Initialize a CreditCardInfo instance."""
        # Initialize members of the class
        if credit_card_number is not APIHelper.SKIP:
            self.credit_card_number = credit_card_number
        if exp_month is not APIHelper.SKIP:
            self.exp_month = exp_month
        if exp_year is not APIHelper.SKIP:
            self.exp_year = exp_year
        if billing_name is not APIHelper.SKIP:
            self.billing_name = billing_name
        if billing_address is not APIHelper.SKIP:
            self.billing_address = billing_address
        if billing_city is not APIHelper.SKIP:
            self.billing_city = billing_city
        if billing_state is not APIHelper.SKIP:
            self.billing_state = billing_state
        if billing_postal_code is not APIHelper.SKIP:
            self.billing_postal_code = billing_postal_code
        if save_info is not APIHelper.SKIP:
            self.save_info = save_info
        if card_id is not APIHelper.SKIP:
            self.card_id = card_id
        if cvv is not APIHelper.SKIP:
            self.cvv = cvv

    @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
        credit_card_number =\
            dictionary.get("CreditCardNumber")\
            if dictionary.get("CreditCardNumber")\
                else APIHelper.SKIP
        exp_month =\
            dictionary.get("ExpMonth")\
            if dictionary.get("ExpMonth")\
                else APIHelper.SKIP
        exp_year =\
            dictionary.get("ExpYear")\
            if dictionary.get("ExpYear")\
                else APIHelper.SKIP
        billing_name =\
            dictionary.get("BillingName")\
            if dictionary.get("BillingName")\
                else APIHelper.SKIP
        billing_address =\
            dictionary.get("BillingAddress")\
            if dictionary.get("BillingAddress")\
                else APIHelper.SKIP
        billing_city =\
            dictionary.get("BillingCity")\
            if dictionary.get("BillingCity")\
                else APIHelper.SKIP
        billing_state =\
            dictionary.get("BillingState")\
            if dictionary.get("BillingState")\
                else APIHelper.SKIP
        billing_postal_code =\
            dictionary.get("BillingPostalCode")\
            if dictionary.get("BillingPostalCode")\
                else APIHelper.SKIP
        save_info =\
            dictionary.get("SaveInfo")\
            if "SaveInfo" in dictionary.keys()\
                else APIHelper.SKIP
        card_id =\
            dictionary.get("CardId")\
            if dictionary.get("CardId")\
                else APIHelper.SKIP
        cvv =\
            dictionary.get("CVV")\
            if dictionary.get("CVV")\
                else APIHelper.SKIP

        # Return an object of this model
        return cls(credit_card_number,
                   exp_month,
                   exp_year,
                   billing_name,
                   billing_address,
                   billing_city,
                   billing_state,
                   billing_postal_code,
                   save_info,
                   card_id,
                   cvv)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _credit_card_number=(
            self.credit_card_number
            if hasattr(self, "credit_card_number")
            else None
        )
        _exp_month=(
            self.exp_month
            if hasattr(self, "exp_month")
            else None
        )
        _exp_year=(
            self.exp_year
            if hasattr(self, "exp_year")
            else None
        )
        _billing_name=(
            self.billing_name
            if hasattr(self, "billing_name")
            else None
        )
        _billing_address=(
            self.billing_address
            if hasattr(self, "billing_address")
            else None
        )
        _billing_city=(
            self.billing_city
            if hasattr(self, "billing_city")
            else None
        )
        _billing_state=(
            self.billing_state
            if hasattr(self, "billing_state")
            else None
        )
        _billing_postal_code=(
            self.billing_postal_code
            if hasattr(self, "billing_postal_code")
            else None
        )
        _save_info=(
            self.save_info
            if hasattr(self, "save_info")
            else None
        )
        _card_id=(
            self.card_id
            if hasattr(self, "card_id")
            else None
        )
        _cvv=(
            self.cvv
            if hasattr(self, "cvv")
            else None
        )
        return (
            f"{self.__class__.__name__}("
            f"credit_card_number={_credit_card_number!r}, "
            f"exp_month={_exp_month!r}, "
            f"exp_year={_exp_year!r}, "
            f"billing_name={_billing_name!r}, "
            f"billing_address={_billing_address!r}, "
            f"billing_city={_billing_city!r}, "
            f"billing_state={_billing_state!r}, "
            f"billing_postal_code={_billing_postal_code!r}, "
            f"save_info={_save_info!r}, "
            f"card_id={_card_id!r}, "
            f"cvv={_cvv!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _credit_card_number=(
            self.credit_card_number
            if hasattr(self, "credit_card_number")
            else None
        )
        _exp_month=(
            self.exp_month
            if hasattr(self, "exp_month")
            else None
        )
        _exp_year=(
            self.exp_year
            if hasattr(self, "exp_year")
            else None
        )
        _billing_name=(
            self.billing_name
            if hasattr(self, "billing_name")
            else None
        )
        _billing_address=(
            self.billing_address
            if hasattr(self, "billing_address")
            else None
        )
        _billing_city=(
            self.billing_city
            if hasattr(self, "billing_city")
            else None
        )
        _billing_state=(
            self.billing_state
            if hasattr(self, "billing_state")
            else None
        )
        _billing_postal_code=(
            self.billing_postal_code
            if hasattr(self, "billing_postal_code")
            else None
        )
        _save_info=(
            self.save_info
            if hasattr(self, "save_info")
            else None
        )
        _card_id=(
            self.card_id
            if hasattr(self, "card_id")
            else None
        )
        _cvv=(
            self.cvv
            if hasattr(self, "cvv")
            else None
        )
        return (
            f"{self.__class__.__name__}("
            f"credit_card_number={_credit_card_number!s}, "
            f"exp_month={_exp_month!s}, "
            f"exp_year={_exp_year!s}, "
            f"billing_name={_billing_name!s}, "
            f"billing_address={_billing_address!s}, "
            f"billing_city={_billing_city!s}, "
            f"billing_state={_billing_state!s}, "
            f"billing_postal_code={_billing_postal_code!s}, "
            f"save_info={_save_info!s}, "
            f"card_id={_card_id!s}, "
            f"cvv={_cvv!s}, "
            f")"
        )
