"""cellpointapi.

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

# ruff: noqa: E501
from cellpointapi.api_helper import APIHelper
from cellpointapi.models.card_number import (
    CardNumber,
)
from cellpointapi.models.security_code import (
    SecurityCode,
)


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

    How to configure a given card scheme.

    Attributes:
        security_code (SecurityCode): Configuration related to card security codes
            (e.g. CVVs).
        card_number (CardNumber): The model property of type CardNumber.
        additional_properties (Dict[str, Any]): The additional properties for the
            model.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "security_code": "securityCode",
        "card_number": "cardNumber",
    }

    _optionals = [
        "security_code",
        "card_number",
    ]

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

        # 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
        security_code =\
            SecurityCode.from_dictionary(
                dictionary.get("securityCode"))\
                if "securityCode" in dictionary.keys()\
                else APIHelper.SKIP
        card_number =\
            CardNumber.from_dictionary(
                dictionary.get("cardNumber"))\
                if "cardNumber" 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(security_code,
                   card_number,
                   additional_properties)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _security_code=(
            self.security_code
            if hasattr(self, "security_code")
            else None
        )
        _card_number=(
            self.card_number
            if hasattr(self, "card_number")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"security_code={_security_code!r}, "
            f"card_number={_card_number!r}, "
            f"additional_properties={_additional_properties!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _security_code=(
            self.security_code
            if hasattr(self, "security_code")
            else None
        )
        _card_number=(
            self.card_number
            if hasattr(self, "card_number")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"security_code={_security_code!s}, "
            f"card_number={_card_number!s}, "
            f"additional_properties={_additional_properties!s}, "
            f")"
        )
