"""mindbodypublicapi.

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

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


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

    Represents a request to get products with optional filters.

    Attributes:
        product_ids (List[str]): The barcode number of the product to be filter by.
        search_text (str): A search filter, used for searching by term.
        category_ids (List[int]): A list of revenue category IDs to filter by. Use
            this ID when calling the GET Categories endpoint.
        sub_category_ids (List[int]): A list of subcategory IDs to filter by. Use
            this ID when calling the GET Categories endpoint.
        secondary_category_ids (List[int]): A list of secondary categories to filter
            by. Use this ID when calling the GET Categories endpoint.
        sell_online (bool): When `true`, only products that can be sold online are
            returned.<br />  When `false`, all products are returned.<br />  Default:
            **false**
        location_id (int): The location ID to use to determine the tax for the
            products that this request returns.<br />  Default: **online store**
        limit (int): Number of results to include, defaults to 100
        offset (int): Page offset, defaults to 0.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "product_ids": "ProductIds",
        "search_text": "SearchText",
        "category_ids": "CategoryIds",
        "sub_category_ids": "SubCategoryIds",
        "secondary_category_ids": "SecondaryCategoryIds",
        "sell_online": "SellOnline",
        "location_id": "LocationId",
        "limit": "Limit",
        "offset": "Offset",
    }

    _optionals = [
        "product_ids",
        "search_text",
        "category_ids",
        "sub_category_ids",
        "secondary_category_ids",
        "sell_online",
        "location_id",
        "limit",
        "offset",
    ]

    def __init__(
        self,
        product_ids=APIHelper.SKIP,
        search_text=APIHelper.SKIP,
        category_ids=APIHelper.SKIP,
        sub_category_ids=APIHelper.SKIP,
        secondary_category_ids=APIHelper.SKIP,
        sell_online=APIHelper.SKIP,
        location_id=APIHelper.SKIP,
        limit=APIHelper.SKIP,
        offset=APIHelper.SKIP):
        """Initialize a GetProductsRequest instance."""
        # Initialize members of the class
        if product_ids is not APIHelper.SKIP:
            self.product_ids = product_ids
        if search_text is not APIHelper.SKIP:
            self.search_text = search_text
        if category_ids is not APIHelper.SKIP:
            self.category_ids = category_ids
        if sub_category_ids is not APIHelper.SKIP:
            self.sub_category_ids = sub_category_ids
        if secondary_category_ids is not APIHelper.SKIP:
            self.secondary_category_ids = secondary_category_ids
        if sell_online is not APIHelper.SKIP:
            self.sell_online = sell_online
        if location_id is not APIHelper.SKIP:
            self.location_id = location_id
        if limit is not APIHelper.SKIP:
            self.limit = limit
        if offset is not APIHelper.SKIP:
            self.offset = offset

    @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
        product_ids =\
            dictionary.get("ProductIds")\
            if dictionary.get("ProductIds")\
                else APIHelper.SKIP
        search_text =\
            dictionary.get("SearchText")\
            if dictionary.get("SearchText")\
                else APIHelper.SKIP
        category_ids =\
            dictionary.get("CategoryIds")\
            if dictionary.get("CategoryIds")\
                else APIHelper.SKIP
        sub_category_ids =\
            dictionary.get("SubCategoryIds")\
            if dictionary.get("SubCategoryIds")\
                else APIHelper.SKIP
        secondary_category_ids =\
            dictionary.get("SecondaryCategoryIds")\
            if dictionary.get("SecondaryCategoryIds")\
                else APIHelper.SKIP
        sell_online =\
            dictionary.get("SellOnline")\
            if "SellOnline" in dictionary.keys()\
                else APIHelper.SKIP
        location_id =\
            dictionary.get("LocationId")\
            if dictionary.get("LocationId")\
                else APIHelper.SKIP
        limit =\
            dictionary.get("Limit")\
            if dictionary.get("Limit")\
                else APIHelper.SKIP
        offset =\
            dictionary.get("Offset")\
            if dictionary.get("Offset")\
                else APIHelper.SKIP

        # Return an object of this model
        return cls(product_ids,
                   search_text,
                   category_ids,
                   sub_category_ids,
                   secondary_category_ids,
                   sell_online,
                   location_id,
                   limit,
                   offset)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _product_ids=(
            self.product_ids
            if hasattr(self, "product_ids")
            else None
        )
        _search_text=(
            self.search_text
            if hasattr(self, "search_text")
            else None
        )
        _category_ids=(
            self.category_ids
            if hasattr(self, "category_ids")
            else None
        )
        _sub_category_ids=(
            self.sub_category_ids
            if hasattr(self, "sub_category_ids")
            else None
        )
        _secondary_category_ids=(
            self.secondary_category_ids
            if hasattr(self, "secondary_category_ids")
            else None
        )
        _sell_online=(
            self.sell_online
            if hasattr(self, "sell_online")
            else None
        )
        _location_id=(
            self.location_id
            if hasattr(self, "location_id")
            else None
        )
        _limit=(
            self.limit
            if hasattr(self, "limit")
            else None
        )
        _offset=(
            self.offset
            if hasattr(self, "offset")
            else None
        )
        return (
            f"{self.__class__.__name__}("
            f"product_ids={_product_ids!r}, "
            f"search_text={_search_text!r}, "
            f"category_ids={_category_ids!r}, "
            f"sub_category_ids={_sub_category_ids!r}, "
            f"secondary_category_ids={_secondary_category_ids!r}, "
            f"sell_online={_sell_online!r}, "
            f"location_id={_location_id!r}, "
            f"limit={_limit!r}, "
            f"offset={_offset!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _product_ids=(
            self.product_ids
            if hasattr(self, "product_ids")
            else None
        )
        _search_text=(
            self.search_text
            if hasattr(self, "search_text")
            else None
        )
        _category_ids=(
            self.category_ids
            if hasattr(self, "category_ids")
            else None
        )
        _sub_category_ids=(
            self.sub_category_ids
            if hasattr(self, "sub_category_ids")
            else None
        )
        _secondary_category_ids=(
            self.secondary_category_ids
            if hasattr(self, "secondary_category_ids")
            else None
        )
        _sell_online=(
            self.sell_online
            if hasattr(self, "sell_online")
            else None
        )
        _location_id=(
            self.location_id
            if hasattr(self, "location_id")
            else None
        )
        _limit=(
            self.limit
            if hasattr(self, "limit")
            else None
        )
        _offset=(
            self.offset
            if hasattr(self, "offset")
            else None
        )
        return (
            f"{self.__class__.__name__}("
            f"product_ids={_product_ids!s}, "
            f"search_text={_search_text!s}, "
            f"category_ids={_category_ids!s}, "
            f"sub_category_ids={_sub_category_ids!s}, "
            f"secondary_category_ids={_secondary_category_ids!s}, "
            f"sell_online={_sell_online!s}, "
            f"location_id={_location_id!s}, "
            f"limit={_limit!s}, "
            f"offset={_offset!s}, "
            f")"
        )
