"""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.capture_mandate import (
    CaptureMandate,
)
from visaacceptancemergedspec.models.complete_mandate_2 import (
    CompleteMandate2,
)
from visaacceptancemergedspec.models.order_information_34 import (
    OrderInformation34,
)
from visaacceptancemergedspec.models.transient_token_response_options import (
    TransientTokenResponseOptions,
)


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

    Attributes:
        client_version (str): Specify the version of Unified Checkout that you want
            to use.
        target_origins (List[str]): The [target origin]( of the website on which you
            will be launching Unified Checkout is defined by the scheme (protocol),
            hostname (domain) and port number (if used).    You must use  (unless you
            use  Wildcards are NOT supported.  Ensure that subdomains are included.
            Any valid top-level domain is supported (e.g. .com, .co.uk, .gov.br etc)
            Examples:   -    -    -   If you are embedding within multiple nested
            iframes you need to specify the origins of all the browser contexts used,
            for example:    targetOrigins: [     "     "     "   ]
        allowed_card_networks (List[str]): The list of card networks you want to use
            for this Unified Checkout transaction.  Unified Checkout currently
            supports the following card networks:     - VISA     - MASTERCARD     -
            AMEX     - CARNET     - CARTESBANCAIRES     - CUP     - DINERSCLUB     -
            DISCOVER     - EFTPOS     - ELO     - JCB     - JCREW     - MADA     -
            MAESTRO     - MEEZA     - PAYPAK
        allowed_payment_types (List[str]): The payment types that are allowed for the
            merchant.    Possible values when launching Unified Checkout:   -
            APPLEPAY   - CHECK   - CLICKTOPAY   - GOOGLEPAY   - PANENTRY
            - PAZE <br><br>  Unified Checkout also supports the following Alternative
            Payments:   - AFTERPAY<br><br>  Possible values when launching Click To
            Pay Drop-In UI: - CLICKTOPAY <br><br>  **Important:**    - CLICKTOPAY
            only available for Visa, Mastercard and AMEX for saved cards.   - Visa
            and Mastercard will look to tokenize using network tokenization for all
            Click to Pay requests.  Click to Pay uses Click to Pay token requester
            IDs and not the merchant's existing token requester.   - Apple Pay,
            Google Pay, Check, and Paze can be used independently without requiring
            PAN entry in the allowedPaymentTypes field.<br><br>  **Managing Google
            Pay Authentication Types** When you enable Google Pay on Unified Checkout
            you can specify optional parameters that define the types of card
            authentication you receive from Google Pay.<br><br>  **Managing Google
            Pay Authentication Types** Where Click to Pay is the payment type
            selected by the customer and the customer manually enters their card, the
            option to enroll their card in Click to Pay will be auto-checked if this
            field is set to "true".   This is only available where the merchant and
            cardholder are based in the following countries and the billing type is
            set to "FULL" or "PARTIAL".   - UAE   - Argentina   - Brazil   - Chile
            - Colombia   - Kuwait   - Mexico   - Peru   - Qatar   - Saudi Arabia   -
            Ukraine   - South Africa<br><br>  If false, this is not present or not
            supported in the market.  Enrollment in Click to Pay is not checked for
            the customer when completing manual card entry.
        country (str): Country the purchase is originating from (e.g. country of the
            merchant).  Use the two-character ISO Standard
        locale (str): Localization of the User experience conforming to the ISO 639-1
            language standards and two-character ISO Standard Country Code.  Please
            refer to list of [supported locales through Unified Checkout](
        capture_mandate (CaptureMandate): The model property of type CaptureMandate.
        complete_mandate (CompleteMandate2): The model property of type
            CompleteMandate2.
        order_information (OrderInformation34): The model property of type
            OrderInformation34.
        transient_token_response_options (TransientTokenResponseOptions): The model
            property of type TransientTokenResponseOptions.
        additional_properties (Dict[str, Any]): The additional properties for the
            model.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "client_version": "clientVersion",
        "target_origins": "targetOrigins",
        "allowed_card_networks": "allowedCardNetworks",
        "allowed_payment_types": "allowedPaymentTypes",
        "country": "country",
        "locale": "locale",
        "capture_mandate": "captureMandate",
        "complete_mandate": "completeMandate",
        "order_information": "orderInformation",
        "transient_token_response_options": "transientTokenResponseOptions",
    }

    _optionals = [
        "client_version",
        "target_origins",
        "allowed_card_networks",
        "allowed_payment_types",
        "country",
        "locale",
        "capture_mandate",
        "complete_mandate",
        "order_information",
        "transient_token_response_options",
    ]

    def __init__(
        self,
        client_version=APIHelper.SKIP,
        target_origins=APIHelper.SKIP,
        allowed_card_networks=APIHelper.SKIP,
        allowed_payment_types=APIHelper.SKIP,
        country=APIHelper.SKIP,
        locale=APIHelper.SKIP,
        capture_mandate=APIHelper.SKIP,
        complete_mandate=APIHelper.SKIP,
        order_information=APIHelper.SKIP,
        transient_token_response_options=APIHelper.SKIP,
        additional_properties=None):
        """Initialize a GenerateUnifiedCheckoutCaptureContextRequest instance."""
        # Initialize members of the class
        if client_version is not APIHelper.SKIP:
            self.client_version = client_version
        if target_origins is not APIHelper.SKIP:
            self.target_origins = target_origins
        if allowed_card_networks is not APIHelper.SKIP:
            self.allowed_card_networks = allowed_card_networks
        if allowed_payment_types is not APIHelper.SKIP:
            self.allowed_payment_types = allowed_payment_types
        if country is not APIHelper.SKIP:
            self.country = country
        if locale is not APIHelper.SKIP:
            self.locale = locale
        if capture_mandate is not APIHelper.SKIP:
            self.capture_mandate = capture_mandate
        if complete_mandate is not APIHelper.SKIP:
            self.complete_mandate = complete_mandate
        if order_information is not APIHelper.SKIP:
            self.order_information = order_information
        if transient_token_response_options is not APIHelper.SKIP:
            self.transient_token_response_options = transient_token_response_options

        # 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
        client_version =\
            dictionary.get("clientVersion")\
            if dictionary.get("clientVersion")\
                else APIHelper.SKIP
        target_origins =\
            dictionary.get("targetOrigins")\
            if dictionary.get("targetOrigins")\
                else APIHelper.SKIP
        allowed_card_networks =\
            dictionary.get("allowedCardNetworks")\
            if dictionary.get("allowedCardNetworks")\
                else APIHelper.SKIP
        allowed_payment_types =\
            dictionary.get("allowedPaymentTypes")\
            if dictionary.get("allowedPaymentTypes")\
                else APIHelper.SKIP
        country =\
            dictionary.get("country")\
            if dictionary.get("country")\
                else APIHelper.SKIP
        locale =\
            dictionary.get("locale")\
            if dictionary.get("locale")\
                else APIHelper.SKIP
        capture_mandate =\
            CaptureMandate.from_dictionary(
                dictionary.get("captureMandate"))\
                if "captureMandate" in dictionary.keys()\
                else APIHelper.SKIP
        complete_mandate =\
            CompleteMandate2.from_dictionary(
                dictionary.get("completeMandate"))\
                if "completeMandate" in dictionary.keys()\
                else APIHelper.SKIP
        order_information =\
            OrderInformation34.from_dictionary(
                dictionary.get("orderInformation"))\
                if "orderInformation" in dictionary.keys()\
                else APIHelper.SKIP
        transient_token_response_options =\
            TransientTokenResponseOptions.from_dictionary(
                dictionary.get("transientTokenResponseOptions"))\
                if "transientTokenResponseOptions" 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(client_version,
                   target_origins,
                   allowed_card_networks,
                   allowed_payment_types,
                   country,
                   locale,
                   capture_mandate,
                   complete_mandate,
                   order_information,
                   transient_token_response_options,
                   additional_properties)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _client_version=(
            self.client_version
            if hasattr(self, "client_version")
            else None
        )
        _target_origins=(
            self.target_origins
            if hasattr(self, "target_origins")
            else None
        )
        _allowed_card_networks=(
            self.allowed_card_networks
            if hasattr(self, "allowed_card_networks")
            else None
        )
        _allowed_payment_types=(
            self.allowed_payment_types
            if hasattr(self, "allowed_payment_types")
            else None
        )
        _country=(
            self.country
            if hasattr(self, "country")
            else None
        )
        _locale=(
            self.locale
            if hasattr(self, "locale")
            else None
        )
        _capture_mandate=(
            self.capture_mandate
            if hasattr(self, "capture_mandate")
            else None
        )
        _complete_mandate=(
            self.complete_mandate
            if hasattr(self, "complete_mandate")
            else None
        )
        _order_information=(
            self.order_information
            if hasattr(self, "order_information")
            else None
        )
        _transient_token_response_options=(
            self.transient_token_response_options
            if hasattr(self, "transient_token_response_options")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"client_version={_client_version!r}, "
            f"target_origins={_target_origins!r}, "
            f"allowed_card_networks={_allowed_card_networks!r}, "
            f"allowed_payment_types={_allowed_payment_types!r}, "
            f"country={_country!r}, "
            f"locale={_locale!r}, "
            f"capture_mandate={_capture_mandate!r}, "
            f"complete_mandate={_complete_mandate!r}, "
            f"order_information={_order_information!r}, "
            f"transient_token_response_options={_transient_token_response_options!r}, "
            f"additional_properties={_additional_properties!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _client_version=(
            self.client_version
            if hasattr(self, "client_version")
            else None
        )
        _target_origins=(
            self.target_origins
            if hasattr(self, "target_origins")
            else None
        )
        _allowed_card_networks=(
            self.allowed_card_networks
            if hasattr(self, "allowed_card_networks")
            else None
        )
        _allowed_payment_types=(
            self.allowed_payment_types
            if hasattr(self, "allowed_payment_types")
            else None
        )
        _country=(
            self.country
            if hasattr(self, "country")
            else None
        )
        _locale=(
            self.locale
            if hasattr(self, "locale")
            else None
        )
        _capture_mandate=(
            self.capture_mandate
            if hasattr(self, "capture_mandate")
            else None
        )
        _complete_mandate=(
            self.complete_mandate
            if hasattr(self, "complete_mandate")
            else None
        )
        _order_information=(
            self.order_information
            if hasattr(self, "order_information")
            else None
        )
        _transient_token_response_options=(
            self.transient_token_response_options
            if hasattr(self, "transient_token_response_options")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"client_version={_client_version!s}, "
            f"target_origins={_target_origins!s}, "
            f"allowed_card_networks={_allowed_card_networks!s}, "
            f"allowed_payment_types={_allowed_payment_types!s}, "
            f"country={_country!s}, "
            f"locale={_locale!s}, "
            f"capture_mandate={_capture_mandate!s}, "
            f"complete_mandate={_complete_mandate!s}, "
            f"order_information={_order_information!s}, "
            f"transient_token_response_options={_transient_token_response_options!s}, "
            f"additional_properties={_additional_properties!s}, "
            f")"
        )
