"""paypalserversdk.

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

# ruff: noqa: E501
from paypalserversdk.api_helper import APIHelper
from paypalserversdk.models.card_verification_processor_response import (
    CardVerificationProcessorResponse,
)
from paypalserversdk.models.money import Money


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

    Card Verification details including the authorization details and 3D SECURE
    details.

    Attributes:
        network_transaction_id (str): DEPRECATED. This field is DEPRECATED. Please
            find the network transaction id data in the 'id' field under the
            'network_transaction_reference' object instead of the 'verification'
            object.
        date (str): DEPRECATED. This field is DEPRECATED. Please find the date data
            in the 'date' field under the 'network_transaction_reference' object
            instead of the 'verification' object.
        network (CardBrand): DEPRECATED. This field is DEPRECATED. Please find the
            network data in the 'network' field under the
            'network_transaction_reference' object instead of the 'verification'
            object.
        time (str): DEPRECATED. This field is DEPRECATED. Please find the time data
            in the 'time' field under the 'network_transaction_reference' object
            instead of the 'verification' object.
        amount (Money): The currency and amount for a financial transaction, such as
            a balance or payment due.
        processor_response (CardVerificationProcessorResponse): The processor
            response information for payment requests, such as direct credit card
            transactions.
        three_d_secure (Any): DEPRECATED. This field is DEPRECATED. Please find the
            3D secure authentication data in the 'three_d_secure' object under the
            'authentication_result' object instead of the 'verification' object.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "network_transaction_id": "network_transaction_id",
        "date": "date",
        "network": "network",
        "time": "time",
        "amount": "amount",
        "processor_response": "processor_response",
        "three_d_secure": "three_d_secure",
    }

    _optionals = [
        "network_transaction_id",
        "date",
        "network",
        "time",
        "amount",
        "processor_response",
        "three_d_secure",
    ]

    def __init__(
        self,
        network_transaction_id=APIHelper.SKIP,
        date=APIHelper.SKIP,
        network=APIHelper.SKIP,
        time=APIHelper.SKIP,
        amount=APIHelper.SKIP,
        processor_response=APIHelper.SKIP,
        three_d_secure=APIHelper.SKIP):
        """Initialize a CardVerificationDetails instance."""
        # Initialize members of the class
        if network_transaction_id is not APIHelper.SKIP:
            self.network_transaction_id = network_transaction_id
        if date is not APIHelper.SKIP:
            self.date = date
        if network is not APIHelper.SKIP:
            self.network = network
        if time is not APIHelper.SKIP:
            self.time = time
        if amount is not APIHelper.SKIP:
            self.amount = amount
        if processor_response is not APIHelper.SKIP:
            self.processor_response = processor_response
        if three_d_secure is not APIHelper.SKIP:
            self.three_d_secure = three_d_secure

    @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
        network_transaction_id =\
            dictionary.get("network_transaction_id")\
            if dictionary.get("network_transaction_id")\
                else APIHelper.SKIP
        date =\
            dictionary.get("date")\
            if dictionary.get("date")\
                else APIHelper.SKIP
        network =\
            dictionary.get("network")\
            if dictionary.get("network")\
                else APIHelper.SKIP
        time =\
            dictionary.get("time")\
            if dictionary.get("time")\
                else APIHelper.SKIP
        amount =\
            Money.from_dictionary(
                dictionary.get("amount"))\
                if "amount" in dictionary.keys()\
                else APIHelper.SKIP
        processor_response =\
            CardVerificationProcessorResponse.from_dictionary(
                dictionary.get("processor_response"))\
                if "processor_response" in dictionary.keys()\
                else APIHelper.SKIP
        three_d_secure =\
            dictionary.get("three_d_secure")\
            if dictionary.get("three_d_secure")\
                else APIHelper.SKIP

        # Return an object of this model
        return cls(network_transaction_id,
                   date,
                   network,
                   time,
                   amount,
                   processor_response,
                   three_d_secure)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _network_transaction_id=(
            self.network_transaction_id
            if hasattr(self, "network_transaction_id")
            else None
        )
        _date=(
            self.date
            if hasattr(self, "date")
            else None
        )
        _network=(
            self.network
            if hasattr(self, "network")
            else None
        )
        _time=(
            self.time
            if hasattr(self, "time")
            else None
        )
        _amount=(
            self.amount
            if hasattr(self, "amount")
            else None
        )
        _processor_response=(
            self.processor_response
            if hasattr(self, "processor_response")
            else None
        )
        _three_d_secure=(
            self.three_d_secure
            if hasattr(self, "three_d_secure")
            else None
        )
        return (
            f"{self.__class__.__name__}("
            f"network_transaction_id={_network_transaction_id!r}, "
            f"date={_date!r}, "
            f"network={_network!r}, "
            f"time={_time!r}, "
            f"amount={_amount!r}, "
            f"processor_response={_processor_response!r}, "
            f"three_d_secure={_three_d_secure!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _network_transaction_id=(
            self.network_transaction_id
            if hasattr(self, "network_transaction_id")
            else None
        )
        _date=(
            self.date
            if hasattr(self, "date")
            else None
        )
        _network=(
            self.network
            if hasattr(self, "network")
            else None
        )
        _time=(
            self.time
            if hasattr(self, "time")
            else None
        )
        _amount=(
            self.amount
            if hasattr(self, "amount")
            else None
        )
        _processor_response=(
            self.processor_response
            if hasattr(self, "processor_response")
            else None
        )
        _three_d_secure=(
            self.three_d_secure
            if hasattr(self, "three_d_secure")
            else None
        )
        return (
            f"{self.__class__.__name__}("
            f"network_transaction_id={_network_transaction_id!s}, "
            f"date={_date!s}, "
            f"network={_network!s}, "
            f"time={_time!s}, "
            f"amount={_amount!s}, "
            f"processor_response={_processor_response!s}, "
            f"three_d_secure={_three_d_secure!s}, "
            f")"
        )
