"""visaacceptancemergedspec.

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

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


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

    The completeMandate object is designed to provide instructions for orchestrating
    payment services.  Unified Checkout is capable of orchestrating a number of
    services on your behalf.<br><br>
    By providing this field in the capture context Unified Checkout will initiate
    services on your behalf from the browser, simplifying your integration.

    Attributes:
        mtype (str): This field is used to indicate how a payment should be
            processed.  Possible values: - AUTH: Use this value when you want to
            authorize a payment within Unified Checkout without capturing it
            immediately.  Payment types that initiate an immediate transfer of funds
            are NOT allowed.  If a capture context request includes a payment type
            incompatible with this mode, a 400 error will be returned.  A merchant
            would need to perform their own capture via API where applicable.<br><br>
            - CAPTURE: Use this value when you want to perform a sale within Unified
            Checkout and capture the payment immediately during the transaction.
            Note: Some payment types may return a PENDING status, requiring an
            additional status check call to determine the final outcome of the
            payment.<br><br> - PREFER_AUTH: Use this value to offer multiple
            alternative payment options during the Unified Checkout experience. This
            option authorizes the payment without immediate capture, where available.
            It will perform a "CAPTURE" where an "AUTH" is not allowed by the payment
            type.  Transactions can be AUTHORIZED, CAPTURED, or PENDING.  If an
            "AUTH" is performed, a merchant would need to perform their own capture
            via API where applicable.
        decision_manager (bool): Configure Unified Checkout to determine whether
            Decision Manager is invoked during service orchestration.  Possible
            values:  - True  - False<br><br>  Setting this value to True indicates
            that device fingerprinting will be executed to add additional information
            for risk service Setting this value to False (or not provided) indicates
            that you do not wish to run device fingerprinting and skip decision
            manager services.
        consumer_authentication (bool): Configure Unified Checkout to determine
            whether Consumer Authentication is invoked during service orchestration.
            Possible values:  - True  - False<br><br>  Setting this value to True
            will attempt to perform authentication using the Payer Authentication
            Service. Setting this value to False (or not provided) indicates that you
            do not wish to perform authentication using the Payer Authentication
            Service.
        additional_properties (Dict[str, Any]): The additional properties for the
            model.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "mtype": "type",
        "decision_manager": "decisionManager",
        "consumer_authentication": "consumerAuthentication",
    }

    _optionals = [
        "mtype",
        "decision_manager",
        "consumer_authentication",
    ]

    def __init__(
        self,
        mtype=APIHelper.SKIP,
        decision_manager=APIHelper.SKIP,
        consumer_authentication=APIHelper.SKIP,
        additional_properties=None):
        """Initialize a CompleteMandate instance."""
        # Initialize members of the class
        if mtype is not APIHelper.SKIP:
            self.mtype = mtype
        if decision_manager is not APIHelper.SKIP:
            self.decision_manager = decision_manager
        if consumer_authentication is not APIHelper.SKIP:
            self.consumer_authentication = consumer_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
        mtype =\
            dictionary.get("type")\
            if dictionary.get("type")\
                else APIHelper.SKIP
        decision_manager =\
            dictionary.get("decisionManager")\
            if "decisionManager" in dictionary.keys()\
                else APIHelper.SKIP
        consumer_authentication =\
            dictionary.get("consumerAuthentication")\
            if "consumerAuthentication" 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(mtype,
                   decision_manager,
                   consumer_authentication,
                   additional_properties)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _mtype=(
            self.mtype
            if hasattr(self, "mtype")
            else None
        )
        _decision_manager=(
            self.decision_manager
            if hasattr(self, "decision_manager")
            else None
        )
        _consumer_authentication=(
            self.consumer_authentication
            if hasattr(self, "consumer_authentication")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"mtype={_mtype!r}, "
            f"decision_manager={_decision_manager!r}, "
            f"consumer_authentication={_consumer_authentication!r}, "
            f"additional_properties={_additional_properties!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _mtype=(
            self.mtype
            if hasattr(self, "mtype")
            else None
        )
        _decision_manager=(
            self.decision_manager
            if hasattr(self, "decision_manager")
            else None
        )
        _consumer_authentication=(
            self.consumer_authentication
            if hasattr(self, "consumer_authentication")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"mtype={_mtype!s}, "
            f"decision_manager={_decision_manager!s}, "
            f"consumer_authentication={_consumer_authentication!s}, "
            f"additional_properties={_additional_properties!s}, "
            f")"
        )
