"""mindbodypublicapi.

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

# ruff: noqa: E501
from mindbodypublicapi.api_helper import APIHelper


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

    The API Request model for Complete Checkout Shopping Cart API.

    Attributes:
        access_token (str): The Access Token generated during Pre-Payment step.
        client_id (str): The RSSID of the client making the purchase. A cart can be
            validated without a client ID, but a client ID must be specified to
            complete a sale.
        test (bool): When `true`, indicates that the contents of the cart are
            validated, but the transaction does not take place. You should use this
            parameter during testing and when checking the calculated totals of the
            items in the cart.<br />  When `false`, the transaction takes place and
            the database is affected.<br />  Default: **false**

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "access_token": "AccessToken",
        "client_id": "ClientId",
        "test": "Test",
    }

    _optionals = [
        "test",
    ]

    def __init__(
        self,
        access_token=None,
        client_id=None,
        test=APIHelper.SKIP):
        """Initialize a
        CompleteCheckoutShoppingCartUsingAlternativePaymentsRequest instance.
        """
        # Initialize members of the class
        self.access_token = access_token
        self.client_id = client_id
        if test is not APIHelper.SKIP:
            self.test = test

    @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
        access_token =\
            dictionary.get("AccessToken")\
            if dictionary.get("AccessToken")\
                else None
        client_id =\
            dictionary.get("ClientId")\
            if dictionary.get("ClientId")\
                else None
        test =\
            dictionary.get("Test")\
            if "Test" in dictionary.keys()\
                else APIHelper.SKIP

        # Return an object of this model
        return cls(access_token,
                   client_id,
                   test)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _access_token=self.access_token
        _client_id=self.client_id
        _test=(
            self.test
            if hasattr(self, "test")
            else None
        )
        return (
            f"{self.__class__.__name__}("
            f"access_token={_access_token!r}, "
            f"client_id={_client_id!r}, "
            f"test={_test!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _access_token=self.access_token
        _client_id=self.client_id
        _test=(
            self.test
            if hasattr(self, "test")
            else None
        )
        return (
            f"{self.__class__.__name__}("
            f"access_token={_access_token!s}, "
            f"client_id={_client_id!s}, "
            f"test={_test!s}, "
            f")"
        )
