"""visaacceptancemergedspec.

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

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


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

    Attributes:
        payment_credential_type (str): The type of payment credentials to be
            returned. By default, payment credentials include network token and
            cryptogram or dynamic CVV. If "NETWORK_TOKEN" is supplied then only
            network token card number will be returned and no cryptogram or dynamic
            CVV will be requested. If "SECURITY_CODE" is supplied then dynamic CVV
            will be requested and returned with the network token card number.
            Dynamic CVV is only supported for Amex and SCOF. If "CRYPTOGRAM" is
            supplied then cryptogram will be requested and returned with the network
            token card number. Cryptogram is NOT supported for Amex.  Possible
            Values:   - NETWORK_TOKEN   - SECURITY_CODE   - CRYPTOGRAM
        transaction_type (str): Specifies the type of transaction for which the
            network token credentials are required. Possible Values:   - ECOM:
            Ecommerce transaction. If transactionType is not provided, ECOM is set as
            the default.   - AFT: Account Funding Transaction. This is only supported
            for VISA and paymentCredentialType of CRYPTOGRAM.
        additional_properties (Dict[str, Any]): The additional properties for the
            model.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "payment_credential_type": "paymentCredentialType",
        "transaction_type": "transactionType",
    }

    _optionals = [
        "payment_credential_type",
        "transaction_type",
    ]

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

        # 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
        payment_credential_type =\
            dictionary.get("paymentCredentialType")\
            if dictionary.get("paymentCredentialType")\
                else APIHelper.SKIP
        transaction_type =\
            dictionary.get("transactionType")\
            if dictionary.get("transactionType")\
                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(payment_credential_type,
                   transaction_type,
                   additional_properties)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _payment_credential_type=(
            self.payment_credential_type
            if hasattr(self, "payment_credential_type")
            else None
        )
        _transaction_type=(
            self.transaction_type
            if hasattr(self, "transaction_type")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"payment_credential_type={_payment_credential_type!r}, "
            f"transaction_type={_transaction_type!r}, "
            f"additional_properties={_additional_properties!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _payment_credential_type=(
            self.payment_credential_type
            if hasattr(self, "payment_credential_type")
            else None
        )
        _transaction_type=(
            self.transaction_type
            if hasattr(self, "transaction_type")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"payment_credential_type={_payment_credential_type!s}, "
            f"transaction_type={_transaction_type!s}, "
            f"additional_properties={_additional_properties!s}, "
            f")"
        )
