"""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.gift_card_layout import (
    GiftCardLayout,
)


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

    Attributes:
        id (int): The gift card's `ProductID`.
        location_ids (List[int]): The IDs of the locations where the gift card is
            sold.
        description (str): A description of the gift card.
        editable_by_consumer (bool): When `true`, indicates that the gift card can be
            edited by the client.
        card_value (float): The value of the gift card.
        sale_price (float): The sale price of the gift card, if applicable.
        sold_online (bool): When `true`, indicates that the gift card is sold online.
        membership_restriction_ids (List[int]): A list of IDs for membership
            restrictions, if this card is restricted to members with certain types of
            memberships.
        gift_card_terms (str): The terms of the gift card.
        contact_info (str): Contact information for the gift card.
        display_logo (bool): When `true`, indicates that the logo should be displayed
            on the gift card.
        layouts (List[GiftCardLayout]): A list of layouts available for the gift card.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "id": "Id",
        "location_ids": "LocationIds",
        "description": "Description",
        "editable_by_consumer": "EditableByConsumer",
        "card_value": "CardValue",
        "sale_price": "SalePrice",
        "sold_online": "SoldOnline",
        "membership_restriction_ids": "MembershipRestrictionIds",
        "gift_card_terms": "GiftCardTerms",
        "contact_info": "ContactInfo",
        "display_logo": "DisplayLogo",
        "layouts": "Layouts",
    }

    _optionals = [
        "id",
        "location_ids",
        "description",
        "editable_by_consumer",
        "card_value",
        "sale_price",
        "sold_online",
        "membership_restriction_ids",
        "gift_card_terms",
        "contact_info",
        "display_logo",
        "layouts",
    ]

    def __init__(
        self,
        id=APIHelper.SKIP,
        location_ids=APIHelper.SKIP,
        description=APIHelper.SKIP,
        editable_by_consumer=APIHelper.SKIP,
        card_value=APIHelper.SKIP,
        sale_price=APIHelper.SKIP,
        sold_online=APIHelper.SKIP,
        membership_restriction_ids=APIHelper.SKIP,
        gift_card_terms=APIHelper.SKIP,
        contact_info=APIHelper.SKIP,
        display_logo=APIHelper.SKIP,
        layouts=APIHelper.SKIP):
        """Initialize a GiftCard instance."""
        # Initialize members of the class
        if id is not APIHelper.SKIP:
            self.id = id
        if location_ids is not APIHelper.SKIP:
            self.location_ids = location_ids
        if description is not APIHelper.SKIP:
            self.description = description
        if editable_by_consumer is not APIHelper.SKIP:
            self.editable_by_consumer = editable_by_consumer
        if card_value is not APIHelper.SKIP:
            self.card_value = card_value
        if sale_price is not APIHelper.SKIP:
            self.sale_price = sale_price
        if sold_online is not APIHelper.SKIP:
            self.sold_online = sold_online
        if membership_restriction_ids is not APIHelper.SKIP:
            self.membership_restriction_ids = membership_restriction_ids
        if gift_card_terms is not APIHelper.SKIP:
            self.gift_card_terms = gift_card_terms
        if contact_info is not APIHelper.SKIP:
            self.contact_info = contact_info
        if display_logo is not APIHelper.SKIP:
            self.display_logo = display_logo
        if layouts is not APIHelper.SKIP:
            self.layouts = layouts

    @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
        id =\
            dictionary.get("Id")\
            if dictionary.get("Id")\
                else APIHelper.SKIP
        location_ids =\
            dictionary.get("LocationIds")\
            if dictionary.get("LocationIds")\
                else APIHelper.SKIP
        description =\
            dictionary.get("Description")\
            if dictionary.get("Description")\
                else APIHelper.SKIP
        editable_by_consumer =\
            dictionary.get("EditableByConsumer")\
            if "EditableByConsumer" in dictionary.keys()\
                else APIHelper.SKIP
        card_value =\
            dictionary.get("CardValue")\
            if dictionary.get("CardValue")\
                else APIHelper.SKIP
        sale_price =\
            dictionary.get("SalePrice")\
            if dictionary.get("SalePrice")\
                else APIHelper.SKIP
        sold_online =\
            dictionary.get("SoldOnline")\
            if "SoldOnline" in dictionary.keys()\
                else APIHelper.SKIP
        membership_restriction_ids =\
            dictionary.get("MembershipRestrictionIds")\
            if dictionary.get("MembershipRestrictionIds")\
                else APIHelper.SKIP
        gift_card_terms =\
            dictionary.get("GiftCardTerms")\
            if dictionary.get("GiftCardTerms")\
                else APIHelper.SKIP
        contact_info =\
            dictionary.get("ContactInfo")\
            if dictionary.get("ContactInfo")\
                else APIHelper.SKIP
        display_logo =\
            dictionary.get("DisplayLogo")\
            if "DisplayLogo" in dictionary.keys()\
                else APIHelper.SKIP
        layouts = None
        if dictionary.get("Layouts") is not None:
            layouts = [
                GiftCardLayout.from_dictionary(x)
                    for x in dictionary.get("Layouts")
            ]
        else:
            layouts = APIHelper.SKIP

        # Return an object of this model
        return cls(id,
                   location_ids,
                   description,
                   editable_by_consumer,
                   card_value,
                   sale_price,
                   sold_online,
                   membership_restriction_ids,
                   gift_card_terms,
                   contact_info,
                   display_logo,
                   layouts)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _id=(
            self.id
            if hasattr(self, "id")
            else None
        )
        _location_ids=(
            self.location_ids
            if hasattr(self, "location_ids")
            else None
        )
        _description=(
            self.description
            if hasattr(self, "description")
            else None
        )
        _editable_by_consumer=(
            self.editable_by_consumer
            if hasattr(self, "editable_by_consumer")
            else None
        )
        _card_value=(
            self.card_value
            if hasattr(self, "card_value")
            else None
        )
        _sale_price=(
            self.sale_price
            if hasattr(self, "sale_price")
            else None
        )
        _sold_online=(
            self.sold_online
            if hasattr(self, "sold_online")
            else None
        )
        _membership_restriction_ids=(
            self.membership_restriction_ids
            if hasattr(self, "membership_restriction_ids")
            else None
        )
        _gift_card_terms=(
            self.gift_card_terms
            if hasattr(self, "gift_card_terms")
            else None
        )
        _contact_info=(
            self.contact_info
            if hasattr(self, "contact_info")
            else None
        )
        _display_logo=(
            self.display_logo
            if hasattr(self, "display_logo")
            else None
        )
        _layouts=(
            self.layouts
            if hasattr(self, "layouts")
            else None
        )
        return (
            f"{self.__class__.__name__}("
            f"id={_id!r}, "
            f"location_ids={_location_ids!r}, "
            f"description={_description!r}, "
            f"editable_by_consumer={_editable_by_consumer!r}, "
            f"card_value={_card_value!r}, "
            f"sale_price={_sale_price!r}, "
            f"sold_online={_sold_online!r}, "
            f"membership_restriction_ids={_membership_restriction_ids!r}, "
            f"gift_card_terms={_gift_card_terms!r}, "
            f"contact_info={_contact_info!r}, "
            f"display_logo={_display_logo!r}, "
            f"layouts={_layouts!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _id=(
            self.id
            if hasattr(self, "id")
            else None
        )
        _location_ids=(
            self.location_ids
            if hasattr(self, "location_ids")
            else None
        )
        _description=(
            self.description
            if hasattr(self, "description")
            else None
        )
        _editable_by_consumer=(
            self.editable_by_consumer
            if hasattr(self, "editable_by_consumer")
            else None
        )
        _card_value=(
            self.card_value
            if hasattr(self, "card_value")
            else None
        )
        _sale_price=(
            self.sale_price
            if hasattr(self, "sale_price")
            else None
        )
        _sold_online=(
            self.sold_online
            if hasattr(self, "sold_online")
            else None
        )
        _membership_restriction_ids=(
            self.membership_restriction_ids
            if hasattr(self, "membership_restriction_ids")
            else None
        )
        _gift_card_terms=(
            self.gift_card_terms
            if hasattr(self, "gift_card_terms")
            else None
        )
        _contact_info=(
            self.contact_info
            if hasattr(self, "contact_info")
            else None
        )
        _display_logo=(
            self.display_logo
            if hasattr(self, "display_logo")
            else None
        )
        _layouts=(
            self.layouts
            if hasattr(self, "layouts")
            else None
        )
        return (
            f"{self.__class__.__name__}("
            f"id={_id!s}, "
            f"location_ids={_location_ids!s}, "
            f"description={_description!s}, "
            f"editable_by_consumer={_editable_by_consumer!s}, "
            f"card_value={_card_value!s}, "
            f"sale_price={_sale_price!s}, "
            f"sold_online={_sold_online!s}, "
            f"membership_restriction_ids={_membership_restriction_ids!s}, "
            f"gift_card_terms={_gift_card_terms!s}, "
            f"contact_info={_contact_info!s}, "
            f"display_logo={_display_logo!s}, "
            f"layouts={_layouts!s}, "
            f")"
        )
