"""mindbodypublicapi.

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

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


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

    Request to initiate a purchase contract.

    Attributes:
        test (bool): When `true`, the Public API validates input information, but
            does not commit it, so no client data is affected.<br />  When `false` or
            omitted, the transaction is committed, and client data is affected.<br />
            This endpoint DOES NOT support the `Test` parameter.<br />  Default:
            **false**
        location_id (int): The ID of the location where the client is purchasing the
            contract; used for AutoPays. If no location ID is supplied, it defaults
            to the online store, represented by a null value.   Default: **null**
            (Online store location)
        client_id (str): The ID of the client. Note that this is not the same as the
            client’s unique ID.
        contract_id (int): The ID of the contract being purchased.
        promotion_code (str): A promotion code, if one applies. Promotion codes are
            applied to items that are both marked as pay now in a contract and are
            discounted by the promotion code. If a pay now item is an autopay item,
            its autopay price is the price at the time of checkout, so, if a
            promotion code was applied, all autopays are scheduled using that
            discounted price.
        promotion_codes (List[str]): Promotion codes, if they apply. Promotion codes
            are applied to items that are both marked as pay now in a contract and
            are discounted by the promotion code. If a pay now item is an autopay
            item, its autopay price is the price at the time of checkout, so, if a
            promotion code was applied, all autopays are scheduled using that
            discounted price.
        send_notifications (bool): When `true`, indicates that email and SMS
            notifications should be sent to the client after purchase.<br />
            Default: **true**
        sales_rep_id (int): The ID of the staff member to be marked as the sales rep
            for this contract sale.
        payment_authentication_callback_url (str): The URL consumer is redirected to
            after the payment.
        payment_method_id (int): The type of alternative payment. Possible values
            are:  * 997 - Indicates that the payment method is iDEAL.  * 801 -
            Indicates that the payment method is Apple Pay.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "client_id": "ClientId",
        "contract_id": "ContractId",
        "payment_method_id": "PaymentMethodId",
        "test": "Test",
        "location_id": "LocationId",
        "promotion_code": "PromotionCode",
        "promotion_codes": "PromotionCodes",
        "send_notifications": "SendNotifications",
        "sales_rep_id": "SalesRepId",
        "payment_authentication_callback_url": "PaymentAuthenticationCallbackUrl",
    }

    _optionals = [
        "test",
        "location_id",
        "promotion_code",
        "promotion_codes",
        "send_notifications",
        "sales_rep_id",
        "payment_authentication_callback_url",
    ]

    def __init__(
        self,
        client_id=None,
        contract_id=None,
        payment_method_id=None,
        test=APIHelper.SKIP,
        location_id=APIHelper.SKIP,
        promotion_code=APIHelper.SKIP,
        promotion_codes=APIHelper.SKIP,
        send_notifications=APIHelper.SKIP,
        sales_rep_id=APIHelper.SKIP,
        payment_authentication_callback_url=APIHelper.SKIP):
        """Initialize a InitiatePurchaseContractRequest instance."""
        # Initialize members of the class
        if test is not APIHelper.SKIP:
            self.test = test
        if location_id is not APIHelper.SKIP:
            self.location_id = location_id
        self.client_id = client_id
        self.contract_id = contract_id
        if promotion_code is not APIHelper.SKIP:
            self.promotion_code = promotion_code
        if promotion_codes is not APIHelper.SKIP:
            self.promotion_codes = promotion_codes
        if send_notifications is not APIHelper.SKIP:
            self.send_notifications = send_notifications
        if sales_rep_id is not APIHelper.SKIP:
            self.sales_rep_id = sales_rep_id
        if payment_authentication_callback_url is not APIHelper.SKIP:
            self.payment_authentication_callback_url =\
                 payment_authentication_callback_url
        self.payment_method_id = payment_method_id

    @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_id =\
            dictionary.get("ClientId")\
            if dictionary.get("ClientId")\
                else None
        contract_id =\
            dictionary.get("ContractId")\
            if dictionary.get("ContractId")\
                else None
        payment_method_id =\
            dictionary.get("PaymentMethodId")\
            if dictionary.get("PaymentMethodId")\
                else None
        test =\
            dictionary.get("Test")\
            if "Test" in dictionary.keys()\
                else APIHelper.SKIP
        location_id =\
            dictionary.get("LocationId")\
            if dictionary.get("LocationId")\
                else APIHelper.SKIP
        promotion_code =\
            dictionary.get("PromotionCode")\
            if dictionary.get("PromotionCode")\
                else APIHelper.SKIP
        promotion_codes =\
            dictionary.get("PromotionCodes")\
            if dictionary.get("PromotionCodes")\
                else APIHelper.SKIP
        send_notifications =\
            dictionary.get("SendNotifications")\
            if "SendNotifications" in dictionary.keys()\
                else APIHelper.SKIP
        sales_rep_id =\
            dictionary.get("SalesRepId")\
            if dictionary.get("SalesRepId")\
                else APIHelper.SKIP
        payment_authentication_callback_url =\
            dictionary.get("PaymentAuthenticationCallbackUrl")\
            if dictionary.get("PaymentAuthenticationCallbackUrl")\
                else APIHelper.SKIP

        # Return an object of this model
        return cls(client_id,
                   contract_id,
                   payment_method_id,
                   test,
                   location_id,
                   promotion_code,
                   promotion_codes,
                   send_notifications,
                   sales_rep_id,
                   payment_authentication_callback_url)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _test=(
            self.test
            if hasattr(self, "test")
            else None
        )
        _location_id=(
            self.location_id
            if hasattr(self, "location_id")
            else None
        )
        _client_id=self.client_id
        _contract_id=self.contract_id
        _promotion_code=(
            self.promotion_code
            if hasattr(self, "promotion_code")
            else None
        )
        _promotion_codes=(
            self.promotion_codes
            if hasattr(self, "promotion_codes")
            else None
        )
        _send_notifications=(
            self.send_notifications
            if hasattr(self, "send_notifications")
            else None
        )
        _sales_rep_id=(
            self.sales_rep_id
            if hasattr(self, "sales_rep_id")
            else None
        )
        _payment_authentication_callback_url=(
            self.payment_authentication_callback_url
            if hasattr(self, "payment_authentication_callback_url")
            else None
        )
        _payment_method_id=self.payment_method_id
        return (
            f"{self.__class__.__name__}("
            f"test={_test!r}, "
            f"location_id={_location_id!r}, "
            f"client_id={_client_id!r}, "
            f"contract_id={_contract_id!r}, "
            f"promotion_code={_promotion_code!r}, "
            f"promotion_codes={_promotion_codes!r}, "
            f"send_notifications={_send_notifications!r}, "
            f"sales_rep_id={_sales_rep_id!r}, "
            f"payment_authentication_callback_url={_payment_authentication_callback_url!r}, "
            f"payment_method_id={_payment_method_id!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _test=(
            self.test
            if hasattr(self, "test")
            else None
        )
        _location_id=(
            self.location_id
            if hasattr(self, "location_id")
            else None
        )
        _client_id=self.client_id
        _contract_id=self.contract_id
        _promotion_code=(
            self.promotion_code
            if hasattr(self, "promotion_code")
            else None
        )
        _promotion_codes=(
            self.promotion_codes
            if hasattr(self, "promotion_codes")
            else None
        )
        _send_notifications=(
            self.send_notifications
            if hasattr(self, "send_notifications")
            else None
        )
        _sales_rep_id=(
            self.sales_rep_id
            if hasattr(self, "sales_rep_id")
            else None
        )
        _payment_authentication_callback_url=(
            self.payment_authentication_callback_url
            if hasattr(self, "payment_authentication_callback_url")
            else None
        )
        _payment_method_id=self.payment_method_id
        return (
            f"{self.__class__.__name__}("
            f"test={_test!s}, "
            f"location_id={_location_id!s}, "
            f"client_id={_client_id!s}, "
            f"contract_id={_contract_id!s}, "
            f"promotion_code={_promotion_code!s}, "
            f"promotion_codes={_promotion_codes!s}, "
            f"send_notifications={_send_notifications!s}, "
            f"sales_rep_id={_sales_rep_id!s}, "
            f"payment_authentication_callback_url={_payment_authentication_callback_url!s}, "
            f"payment_method_id={_payment_method_id!s}, "
            f")"
        )
