"""visaacceptancemergedspec.

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

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


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

    Attributes:
        eci_raw (str): Raw electronic commerce indicator (ECI).
        cavv (str): Cardholder authentication verification value (CAVV).
        xid (str): Transaction identifier.
        transaction_id (str): Payer auth Transaction identifier.
        strong_authentication (StrongAuthentication2): The model property of type
            StrongAuthentication2.
        additional_properties (Dict[str, Any]): The additional properties for the
            model.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "eci_raw": "eciRaw",
        "cavv": "cavv",
        "xid": "xid",
        "transaction_id": "transactionId",
        "strong_authentication": "strongAuthentication",
    }

    _optionals = [
        "eci_raw",
        "cavv",
        "xid",
        "transaction_id",
        "strong_authentication",
    ]

    def __init__(
        self,
        eci_raw=APIHelper.SKIP,
        cavv=APIHelper.SKIP,
        xid=APIHelper.SKIP,
        transaction_id=APIHelper.SKIP,
        strong_authentication=APIHelper.SKIP,
        additional_properties=None):
        """Initialize a ConsumerAuthenticationInformation4 instance."""
        # Initialize members of the class
        if eci_raw is not APIHelper.SKIP:
            self.eci_raw = eci_raw
        if cavv is not APIHelper.SKIP:
            self.cavv = cavv
        if xid is not APIHelper.SKIP:
            self.xid = xid
        if transaction_id is not APIHelper.SKIP:
            self.transaction_id = transaction_id
        if strong_authentication is not APIHelper.SKIP:
            self.strong_authentication = strong_authentication

        # 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
        eci_raw =\
            dictionary.get("eciRaw")\
            if dictionary.get("eciRaw")\
                else APIHelper.SKIP
        cavv =\
            dictionary.get("cavv")\
            if dictionary.get("cavv")\
                else APIHelper.SKIP
        xid =\
            dictionary.get("xid")\
            if dictionary.get("xid")\
                else APIHelper.SKIP
        transaction_id =\
            dictionary.get("transactionId")\
            if dictionary.get("transactionId")\
                else APIHelper.SKIP
        strong_authentication =\
            StrongAuthentication2.from_dictionary(
                dictionary.get("strongAuthentication"))\
                if "strongAuthentication" 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(eci_raw,
                   cavv,
                   xid,
                   transaction_id,
                   strong_authentication,
                   additional_properties)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _eci_raw=(
            self.eci_raw
            if hasattr(self, "eci_raw")
            else None
        )
        _cavv=(
            self.cavv
            if hasattr(self, "cavv")
            else None
        )
        _xid=(
            self.xid
            if hasattr(self, "xid")
            else None
        )
        _transaction_id=(
            self.transaction_id
            if hasattr(self, "transaction_id")
            else None
        )
        _strong_authentication=(
            self.strong_authentication
            if hasattr(self, "strong_authentication")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"eci_raw={_eci_raw!r}, "
            f"cavv={_cavv!r}, "
            f"xid={_xid!r}, "
            f"transaction_id={_transaction_id!r}, "
            f"strong_authentication={_strong_authentication!r}, "
            f"additional_properties={_additional_properties!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _eci_raw=(
            self.eci_raw
            if hasattr(self, "eci_raw")
            else None
        )
        _cavv=(
            self.cavv
            if hasattr(self, "cavv")
            else None
        )
        _xid=(
            self.xid
            if hasattr(self, "xid")
            else None
        )
        _transaction_id=(
            self.transaction_id
            if hasattr(self, "transaction_id")
            else None
        )
        _strong_authentication=(
            self.strong_authentication
            if hasattr(self, "strong_authentication")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"eci_raw={_eci_raw!s}, "
            f"cavv={_cavv!s}, "
            f"xid={_xid!s}, "
            f"transaction_id={_transaction_id!s}, "
            f"strong_authentication={_strong_authentication!s}, "
            f"additional_properties={_additional_properties!s}, "
            f")"
        )
