"""mindbodypublicapi.

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

# ruff: noqa: E501
from mindbodypublicapi.api_helper import APIHelper
from mindbodypublicapi.models.checkout_payment_info import (
    CheckoutPaymentInfo,
)


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

    Attributes:
        test (bool): When `true`, allows you to test the request without affecting
            the database.<br />  When `false`, the request is carried out and the
            database is affected.
        location_id (int): The ID of the location where the gift card is being sold.
        layout_id (int): The ID of the layout used for the gift card’s image.
        purchaser_client_id (str): The RSSID of the client who is purchasing the gift
            card.
        gift_card_id (int): The product ID of the gift card being purchased.
        send_email_receipt (bool): When `true`, indicates that a purchase receipt
            email should be sent to the purchasing client, if all settings are
            correctly configured.<br />  When `false`, no email is sent to the
            purchaser.
        recipient_email (str): The email address to send the gift card image to. This
            parameter is required if the `LayoutId` is not 0.<br />  Maximum length:
            **100**
        recipient_name (str): The name of the person who is to receive the gift card.
            This parameter is required if the `LayoutId` is not 0.<br />  Maximum
            length: **20**
        title (str): The text to use as the title of the gift card, for example:
            Happy Birthday, Maria! This parameter is required if the `LayoutId` is
            not 0.<br />  Maximum length: **20**
        gift_message (str): A personal message to include in the gift card.<br />
            Maximum length: **300**
        delivery_date (datetime): The date that the gift card’s image is to be
            delivered to the recipient. This parameter cannot be set to a date in the
            past. This parameter is required if the `LayoutId` is not 0.  Default:
            **today**  Minimum: **today**
        payment_info (CheckoutPaymentInfo): The model property of type
            CheckoutPaymentInfo.
        sales_rep_id (int): The ID of the staff member who is to be marked as the
            sales rep for this gift card purchase.
        consumer_present (bool): When `true`, indicates that the consumer is
            available to address any SCA challenge issued by the bank.  EU Only.<br
            />   Default: **false**
        payment_authentication_callback_url (str): This is the Url the consumer will
            be redirected back to after completion of the Banks SCA challenge.
        barcode_id (str): Sets the barcode ID of the giftcard. When not provided, a
            barcode ID is automatically generated.<br />  If a giftcard with the
            given barcode ID already exists and the site supports reloadable
            giftcards, the existing giftcard is reloaded<br />  Maximum length:
            **100**
        sender_name (str): Overrides the name that would otherwise be populated by
            specifying PurchaserClientId.<br />  Maximum length: **20**

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "location_id": "LocationId",
        "purchaser_client_id": "PurchaserClientId",
        "gift_card_id": "GiftCardId",
        "test": "Test",
        "layout_id": "LayoutId",
        "send_email_receipt": "SendEmailReceipt",
        "recipient_email": "RecipientEmail",
        "recipient_name": "RecipientName",
        "title": "Title",
        "gift_message": "GiftMessage",
        "delivery_date": "DeliveryDate",
        "payment_info": "PaymentInfo",
        "sales_rep_id": "SalesRepId",
        "consumer_present": "ConsumerPresent",
        "payment_authentication_callback_url": "PaymentAuthenticationCallbackUrl",
        "barcode_id": "BarcodeId",
        "sender_name": "SenderName",
    }

    _optionals = [
        "test",
        "layout_id",
        "send_email_receipt",
        "recipient_email",
        "recipient_name",
        "title",
        "gift_message",
        "delivery_date",
        "payment_info",
        "sales_rep_id",
        "consumer_present",
        "payment_authentication_callback_url",
        "barcode_id",
        "sender_name",
    ]

    def __init__(
        self,
        location_id=None,
        purchaser_client_id=None,
        gift_card_id=None,
        test=APIHelper.SKIP,
        layout_id=APIHelper.SKIP,
        send_email_receipt=APIHelper.SKIP,
        recipient_email=APIHelper.SKIP,
        recipient_name=APIHelper.SKIP,
        title=APIHelper.SKIP,
        gift_message=APIHelper.SKIP,
        delivery_date=APIHelper.SKIP,
        payment_info=APIHelper.SKIP,
        sales_rep_id=APIHelper.SKIP,
        consumer_present=APIHelper.SKIP,
        payment_authentication_callback_url=APIHelper.SKIP,
        barcode_id=APIHelper.SKIP,
        sender_name=APIHelper.SKIP):
        """Initialize a PurchaseGiftCardRequest instance."""
        # Initialize members of the class
        if test is not APIHelper.SKIP:
            self.test = test
        self.location_id = location_id
        if layout_id is not APIHelper.SKIP:
            self.layout_id = layout_id
        self.purchaser_client_id = purchaser_client_id
        self.gift_card_id = gift_card_id
        if send_email_receipt is not APIHelper.SKIP:
            self.send_email_receipt = send_email_receipt
        if recipient_email is not APIHelper.SKIP:
            self.recipient_email = recipient_email
        if recipient_name is not APIHelper.SKIP:
            self.recipient_name = recipient_name
        if title is not APIHelper.SKIP:
            self.title = title
        if gift_message is not APIHelper.SKIP:
            self.gift_message = gift_message
        if delivery_date is not APIHelper.SKIP:
            self.delivery_date =\
                 APIHelper.apply_datetime_converter(
                delivery_date, APIHelper.RFC3339DateTime)\
                 if delivery_date else None
        if payment_info is not APIHelper.SKIP:
            self.payment_info = payment_info
        if sales_rep_id is not APIHelper.SKIP:
            self.sales_rep_id = sales_rep_id
        if consumer_present is not APIHelper.SKIP:
            self.consumer_present = consumer_present
        if payment_authentication_callback_url is not APIHelper.SKIP:
            self.payment_authentication_callback_url =\
                 payment_authentication_callback_url
        if barcode_id is not APIHelper.SKIP:
            self.barcode_id = barcode_id
        if sender_name is not APIHelper.SKIP:
            self.sender_name = sender_name

    @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
        location_id =\
            dictionary.get("LocationId")\
            if dictionary.get("LocationId")\
                else None
        purchaser_client_id =\
            dictionary.get("PurchaserClientId")\
            if dictionary.get("PurchaserClientId")\
                else None
        gift_card_id =\
            dictionary.get("GiftCardId")\
            if dictionary.get("GiftCardId")\
                else None
        test =\
            dictionary.get("Test")\
            if "Test" in dictionary.keys()\
                else APIHelper.SKIP
        layout_id =\
            dictionary.get("LayoutId")\
            if dictionary.get("LayoutId")\
                else APIHelper.SKIP
        send_email_receipt =\
            dictionary.get("SendEmailReceipt")\
            if "SendEmailReceipt" in dictionary.keys()\
                else APIHelper.SKIP
        recipient_email =\
            dictionary.get("RecipientEmail")\
            if dictionary.get("RecipientEmail")\
                else APIHelper.SKIP
        recipient_name =\
            dictionary.get("RecipientName")\
            if dictionary.get("RecipientName")\
                else APIHelper.SKIP
        title =\
            dictionary.get("Title")\
            if dictionary.get("Title")\
                else APIHelper.SKIP
        gift_message =\
            dictionary.get("GiftMessage")\
            if dictionary.get("GiftMessage")\
                else APIHelper.SKIP
        delivery_date = APIHelper.RFC3339DateTime.from_value(
            dictionary.get("DeliveryDate")).datetime\
            if dictionary.get("DeliveryDate") else APIHelper.SKIP
        payment_info =\
            CheckoutPaymentInfo.from_dictionary(
                dictionary.get("PaymentInfo"))\
                if "PaymentInfo" in dictionary.keys()\
                else APIHelper.SKIP
        sales_rep_id =\
            dictionary.get("SalesRepId")\
            if dictionary.get("SalesRepId")\
                else APIHelper.SKIP
        consumer_present =\
            dictionary.get("ConsumerPresent")\
            if "ConsumerPresent" in dictionary.keys()\
                else APIHelper.SKIP
        payment_authentication_callback_url =\
            dictionary.get("PaymentAuthenticationCallbackUrl")\
            if dictionary.get("PaymentAuthenticationCallbackUrl")\
                else APIHelper.SKIP
        barcode_id =\
            dictionary.get("BarcodeId")\
            if dictionary.get("BarcodeId")\
                else APIHelper.SKIP
        sender_name =\
            dictionary.get("SenderName")\
            if dictionary.get("SenderName")\
                else APIHelper.SKIP

        # Return an object of this model
        return cls(location_id,
                   purchaser_client_id,
                   gift_card_id,
                   test,
                   layout_id,
                   send_email_receipt,
                   recipient_email,
                   recipient_name,
                   title,
                   gift_message,
                   delivery_date,
                   payment_info,
                   sales_rep_id,
                   consumer_present,
                   payment_authentication_callback_url,
                   barcode_id,
                   sender_name)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _test=(
            self.test
            if hasattr(self, "test")
            else None
        )
        _location_id=self.location_id
        _layout_id=(
            self.layout_id
            if hasattr(self, "layout_id")
            else None
        )
        _purchaser_client_id=self.purchaser_client_id
        _gift_card_id=self.gift_card_id
        _send_email_receipt=(
            self.send_email_receipt
            if hasattr(self, "send_email_receipt")
            else None
        )
        _recipient_email=(
            self.recipient_email
            if hasattr(self, "recipient_email")
            else None
        )
        _recipient_name=(
            self.recipient_name
            if hasattr(self, "recipient_name")
            else None
        )
        _title=(
            self.title
            if hasattr(self, "title")
            else None
        )
        _gift_message=(
            self.gift_message
            if hasattr(self, "gift_message")
            else None
        )
        _delivery_date=(
            self.delivery_date
            if hasattr(self, "delivery_date")
            else None
        )
        _payment_info=(
            self.payment_info
            if hasattr(self, "payment_info")
            else None
        )
        _sales_rep_id=(
            self.sales_rep_id
            if hasattr(self, "sales_rep_id")
            else None
        )
        _consumer_present=(
            self.consumer_present
            if hasattr(self, "consumer_present")
            else None
        )
        _payment_authentication_callback_url=(
            self.payment_authentication_callback_url
            if hasattr(self, "payment_authentication_callback_url")
            else None
        )
        _barcode_id=(
            self.barcode_id
            if hasattr(self, "barcode_id")
            else None
        )
        _sender_name=(
            self.sender_name
            if hasattr(self, "sender_name")
            else None
        )
        return (
            f"{self.__class__.__name__}("
            f"test={_test!r}, "
            f"location_id={_location_id!r}, "
            f"layout_id={_layout_id!r}, "
            f"purchaser_client_id={_purchaser_client_id!r}, "
            f"gift_card_id={_gift_card_id!r}, "
            f"send_email_receipt={_send_email_receipt!r}, "
            f"recipient_email={_recipient_email!r}, "
            f"recipient_name={_recipient_name!r}, "
            f"title={_title!r}, "
            f"gift_message={_gift_message!r}, "
            f"delivery_date={_delivery_date!r}, "
            f"payment_info={_payment_info!r}, "
            f"sales_rep_id={_sales_rep_id!r}, "
            f"consumer_present={_consumer_present!r}, "
            f"payment_authentication_callback_url={_payment_authentication_callback_url!r}, "
            f"barcode_id={_barcode_id!r}, "
            f"sender_name={_sender_name!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
        _layout_id=(
            self.layout_id
            if hasattr(self, "layout_id")
            else None
        )
        _purchaser_client_id=self.purchaser_client_id
        _gift_card_id=self.gift_card_id
        _send_email_receipt=(
            self.send_email_receipt
            if hasattr(self, "send_email_receipt")
            else None
        )
        _recipient_email=(
            self.recipient_email
            if hasattr(self, "recipient_email")
            else None
        )
        _recipient_name=(
            self.recipient_name
            if hasattr(self, "recipient_name")
            else None
        )
        _title=(
            self.title
            if hasattr(self, "title")
            else None
        )
        _gift_message=(
            self.gift_message
            if hasattr(self, "gift_message")
            else None
        )
        _delivery_date=(
            self.delivery_date
            if hasattr(self, "delivery_date")
            else None
        )
        _payment_info=(
            self.payment_info
            if hasattr(self, "payment_info")
            else None
        )
        _sales_rep_id=(
            self.sales_rep_id
            if hasattr(self, "sales_rep_id")
            else None
        )
        _consumer_present=(
            self.consumer_present
            if hasattr(self, "consumer_present")
            else None
        )
        _payment_authentication_callback_url=(
            self.payment_authentication_callback_url
            if hasattr(self, "payment_authentication_callback_url")
            else None
        )
        _barcode_id=(
            self.barcode_id
            if hasattr(self, "barcode_id")
            else None
        )
        _sender_name=(
            self.sender_name
            if hasattr(self, "sender_name")
            else None
        )
        return (
            f"{self.__class__.__name__}("
            f"test={_test!s}, "
            f"location_id={_location_id!s}, "
            f"layout_id={_layout_id!s}, "
            f"purchaser_client_id={_purchaser_client_id!s}, "
            f"gift_card_id={_gift_card_id!s}, "
            f"send_email_receipt={_send_email_receipt!s}, "
            f"recipient_email={_recipient_email!s}, "
            f"recipient_name={_recipient_name!s}, "
            f"title={_title!s}, "
            f"gift_message={_gift_message!s}, "
            f"delivery_date={_delivery_date!s}, "
            f"payment_info={_payment_info!s}, "
            f"sales_rep_id={_sales_rep_id!s}, "
            f"consumer_present={_consumer_present!s}, "
            f"payment_authentication_callback_url={_payment_authentication_callback_url!s}, "
            f"barcode_id={_barcode_id!s}, "
            f"sender_name={_sender_name!s}, "
            f")"
        )
