"""visaacceptancemergedspec.

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

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


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

    Attributes:
        last_change_date (str): Date the cardholder’s account was last changed. This
            includes changes to the billing or shipping address, new payment accounts
            or new users added. Recommended for Discover ProtectBuy.
        creation_history (str): The values from the enum can be: - GUEST -
            NEW_ACCOUNT - EXISTING_ACCOUNT
        modification_history (str): This field is applicable only in case of
            EXISTING_ACCOUNT in creationHistory. Possible values: -
            ACCOUNT_UPDATED_NOW - ACCOUNT_UPDATED_PAST
        password_history (str): This only applies for EXISTING_ACCOUNT in
            creationHistory. The values from the enum can be: - PASSWORD_CHANGED_NOW
            - PASSWORD_CHANGED_PAST - PASSWORD_NEVER_CHANGED
        create_date (str): Date the cardholder opened the account. Recommended for
            Discover ProtectBuy. This only applies for EXISTING_ACCOUNT in
            creationHistory.
        password_change_date (str): Date the cardholder last changed or reset
            password on account. Recommended for Discover ProtectBuy. This only
            applies for PASSWORD_CHANGED_PAST in passwordHistory.
        additional_properties (Dict[str, Any]): The additional properties for the
            model.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "last_change_date": "lastChangeDate",
        "creation_history": "creationHistory",
        "modification_history": "modificationHistory",
        "password_history": "passwordHistory",
        "create_date": "createDate",
        "password_change_date": "passwordChangeDate",
    }

    _optionals = [
        "last_change_date",
        "creation_history",
        "modification_history",
        "password_history",
        "create_date",
        "password_change_date",
    ]

    def __init__(
        self,
        last_change_date=APIHelper.SKIP,
        creation_history=APIHelper.SKIP,
        modification_history=APIHelper.SKIP,
        password_history=APIHelper.SKIP,
        create_date=APIHelper.SKIP,
        password_change_date=APIHelper.SKIP,
        additional_properties=None):
        """Initialize a CustomerAccount instance."""
        # Initialize members of the class
        if last_change_date is not APIHelper.SKIP:
            self.last_change_date = last_change_date
        if creation_history is not APIHelper.SKIP:
            self.creation_history = creation_history
        if modification_history is not APIHelper.SKIP:
            self.modification_history = modification_history
        if password_history is not APIHelper.SKIP:
            self.password_history = password_history
        if create_date is not APIHelper.SKIP:
            self.create_date = create_date
        if password_change_date is not APIHelper.SKIP:
            self.password_change_date = password_change_date

        # 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
        last_change_date =\
            dictionary.get("lastChangeDate")\
            if dictionary.get("lastChangeDate")\
                else APIHelper.SKIP
        creation_history =\
            dictionary.get("creationHistory")\
            if dictionary.get("creationHistory")\
                else APIHelper.SKIP
        modification_history =\
            dictionary.get("modificationHistory")\
            if dictionary.get("modificationHistory")\
                else APIHelper.SKIP
        password_history =\
            dictionary.get("passwordHistory")\
            if dictionary.get("passwordHistory")\
                else APIHelper.SKIP
        create_date =\
            dictionary.get("createDate")\
            if dictionary.get("createDate")\
                else APIHelper.SKIP
        password_change_date =\
            dictionary.get("passwordChangeDate")\
            if dictionary.get("passwordChangeDate")\
                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(last_change_date,
                   creation_history,
                   modification_history,
                   password_history,
                   create_date,
                   password_change_date,
                   additional_properties)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _last_change_date=(
            self.last_change_date
            if hasattr(self, "last_change_date")
            else None
        )
        _creation_history=(
            self.creation_history
            if hasattr(self, "creation_history")
            else None
        )
        _modification_history=(
            self.modification_history
            if hasattr(self, "modification_history")
            else None
        )
        _password_history=(
            self.password_history
            if hasattr(self, "password_history")
            else None
        )
        _create_date=(
            self.create_date
            if hasattr(self, "create_date")
            else None
        )
        _password_change_date=(
            self.password_change_date
            if hasattr(self, "password_change_date")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"last_change_date={_last_change_date!r}, "
            f"creation_history={_creation_history!r}, "
            f"modification_history={_modification_history!r}, "
            f"password_history={_password_history!r}, "
            f"create_date={_create_date!r}, "
            f"password_change_date={_password_change_date!r}, "
            f"additional_properties={_additional_properties!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _last_change_date=(
            self.last_change_date
            if hasattr(self, "last_change_date")
            else None
        )
        _creation_history=(
            self.creation_history
            if hasattr(self, "creation_history")
            else None
        )
        _modification_history=(
            self.modification_history
            if hasattr(self, "modification_history")
            else None
        )
        _password_history=(
            self.password_history
            if hasattr(self, "password_history")
            else None
        )
        _create_date=(
            self.create_date
            if hasattr(self, "create_date")
            else None
        )
        _password_change_date=(
            self.password_change_date
            if hasattr(self, "password_change_date")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"last_change_date={_last_change_date!s}, "
            f"creation_history={_creation_history!s}, "
            f"modification_history={_modification_history!s}, "
            f"password_history={_password_history!s}, "
            f"create_date={_create_date!s}, "
            f"password_change_date={_password_change_date!s}, "
            f"additional_properties={_additional_properties!s}, "
            f")"
        )
