"""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.color import Color
from mindbodypublicapi.models.size import Size


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

    Represents a product.

    Attributes:
        product_id (int): The unique ID associated with product.
        id (str): The barcode number of the product. This is the
            `PurchasedItems[].BarcodeId` returned from GET Sales.
        category_id (int): The revenue category ID of the product. Use this ID when
            calling the GET Categories endpoint.
        sub_category_id (int): The SubCategory ID of the product. Use this ID when
            calling the GET Categories endpoint.
        secondary_category_id (int): The SecondaryCategory ID of the product. Use
            this ID when calling the GET Categories endpoint.
        price (float): The price of the product.
        tax_included (float): If tax inclusive-pricing is enabled, this field shows
            how much tax was added to the price. To fetch this value `LocationId`
            must be passed as a query parameter.
        tax_rate (float): The tax rate that was applied to this purchase. To fetch
            this value `LocationId` must be passed as a query parameter.
        group_id (int): The unique ID of the product group.
        name (str): The name of the product.
        online_price (float): The online price of the product.
        short_description (str): A short text description of the product.
        long_description (str): A long, more detailed text description of the product.
        type_group (int): The Type group of the product.
        supplier_id (int): The unique ID of the supplier of product.
        supplier_name (str): The Supplier Name of the product.
        image_url (str): The URL of the image associated with this product.
        color (Color): A color used by products.
        size (Size): The model property of type Size.
        manufacturer_id (str): The ID number attributed to the product by the
            manufacturer.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "product_id": "ProductId",
        "id": "Id",
        "category_id": "CategoryId",
        "sub_category_id": "SubCategoryId",
        "secondary_category_id": "SecondaryCategoryId",
        "price": "Price",
        "tax_included": "TaxIncluded",
        "tax_rate": "TaxRate",
        "group_id": "GroupId",
        "name": "Name",
        "online_price": "OnlinePrice",
        "short_description": "ShortDescription",
        "long_description": "LongDescription",
        "type_group": "TypeGroup",
        "supplier_id": "SupplierId",
        "supplier_name": "SupplierName",
        "image_url": "ImageURL",
        "color": "Color",
        "size": "Size",
        "manufacturer_id": "ManufacturerId",
    }

    _optionals = [
        "product_id",
        "id",
        "category_id",
        "sub_category_id",
        "secondary_category_id",
        "price",
        "tax_included",
        "tax_rate",
        "group_id",
        "name",
        "online_price",
        "short_description",
        "long_description",
        "type_group",
        "supplier_id",
        "supplier_name",
        "image_url",
        "color",
        "size",
        "manufacturer_id",
    ]

    def __init__(
        self,
        product_id=APIHelper.SKIP,
        id=APIHelper.SKIP,
        category_id=APIHelper.SKIP,
        sub_category_id=APIHelper.SKIP,
        secondary_category_id=APIHelper.SKIP,
        price=APIHelper.SKIP,
        tax_included=APIHelper.SKIP,
        tax_rate=APIHelper.SKIP,
        group_id=APIHelper.SKIP,
        name=APIHelper.SKIP,
        online_price=APIHelper.SKIP,
        short_description=APIHelper.SKIP,
        long_description=APIHelper.SKIP,
        type_group=APIHelper.SKIP,
        supplier_id=APIHelper.SKIP,
        supplier_name=APIHelper.SKIP,
        image_url=APIHelper.SKIP,
        color=APIHelper.SKIP,
        size=APIHelper.SKIP,
        manufacturer_id=APIHelper.SKIP):
        """Initialize a Product instance."""
        # Initialize members of the class
        if product_id is not APIHelper.SKIP:
            self.product_id = product_id
        if id is not APIHelper.SKIP:
            self.id = id
        if category_id is not APIHelper.SKIP:
            self.category_id = category_id
        if sub_category_id is not APIHelper.SKIP:
            self.sub_category_id = sub_category_id
        if secondary_category_id is not APIHelper.SKIP:
            self.secondary_category_id = secondary_category_id
        if price is not APIHelper.SKIP:
            self.price = price
        if tax_included is not APIHelper.SKIP:
            self.tax_included = tax_included
        if tax_rate is not APIHelper.SKIP:
            self.tax_rate = tax_rate
        if group_id is not APIHelper.SKIP:
            self.group_id = group_id
        if name is not APIHelper.SKIP:
            self.name = name
        if online_price is not APIHelper.SKIP:
            self.online_price = online_price
        if short_description is not APIHelper.SKIP:
            self.short_description = short_description
        if long_description is not APIHelper.SKIP:
            self.long_description = long_description
        if type_group is not APIHelper.SKIP:
            self.type_group = type_group
        if supplier_id is not APIHelper.SKIP:
            self.supplier_id = supplier_id
        if supplier_name is not APIHelper.SKIP:
            self.supplier_name = supplier_name
        if image_url is not APIHelper.SKIP:
            self.image_url = image_url
        if color is not APIHelper.SKIP:
            self.color = color
        if size is not APIHelper.SKIP:
            self.size = size
        if manufacturer_id is not APIHelper.SKIP:
            self.manufacturer_id = manufacturer_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
        product_id =\
            dictionary.get("ProductId")\
            if dictionary.get("ProductId")\
                else APIHelper.SKIP
        id =\
            dictionary.get("Id")\
            if dictionary.get("Id")\
                else APIHelper.SKIP
        category_id =\
            dictionary.get("CategoryId")\
            if dictionary.get("CategoryId")\
                else APIHelper.SKIP
        sub_category_id =\
            dictionary.get("SubCategoryId")\
            if dictionary.get("SubCategoryId")\
                else APIHelper.SKIP
        secondary_category_id =\
            dictionary.get("SecondaryCategoryId")\
            if dictionary.get("SecondaryCategoryId")\
                else APIHelper.SKIP
        price =\
            dictionary.get("Price")\
            if dictionary.get("Price")\
                else APIHelper.SKIP
        tax_included =\
            dictionary.get("TaxIncluded")\
            if dictionary.get("TaxIncluded")\
                else APIHelper.SKIP
        tax_rate =\
            dictionary.get("TaxRate")\
            if dictionary.get("TaxRate")\
                else APIHelper.SKIP
        group_id =\
            dictionary.get("GroupId")\
            if dictionary.get("GroupId")\
                else APIHelper.SKIP
        name =\
            dictionary.get("Name")\
            if dictionary.get("Name")\
                else APIHelper.SKIP
        online_price =\
            dictionary.get("OnlinePrice")\
            if dictionary.get("OnlinePrice")\
                else APIHelper.SKIP
        short_description =\
            dictionary.get("ShortDescription")\
            if dictionary.get("ShortDescription")\
                else APIHelper.SKIP
        long_description =\
            dictionary.get("LongDescription")\
            if dictionary.get("LongDescription")\
                else APIHelper.SKIP
        type_group =\
            dictionary.get("TypeGroup")\
            if dictionary.get("TypeGroup")\
                else APIHelper.SKIP
        supplier_id =\
            dictionary.get("SupplierId")\
            if dictionary.get("SupplierId")\
                else APIHelper.SKIP
        supplier_name =\
            dictionary.get("SupplierName")\
            if dictionary.get("SupplierName")\
                else APIHelper.SKIP
        image_url =\
            dictionary.get("ImageURL")\
            if dictionary.get("ImageURL")\
                else APIHelper.SKIP
        color =\
            Color.from_dictionary(
                dictionary.get("Color"))\
                if "Color" in dictionary.keys()\
                else APIHelper.SKIP
        size =\
            Size.from_dictionary(
                dictionary.get("Size"))\
                if "Size" in dictionary.keys()\
                else APIHelper.SKIP
        manufacturer_id =\
            dictionary.get("ManufacturerId")\
            if dictionary.get("ManufacturerId")\
                else APIHelper.SKIP

        # Return an object of this model
        return cls(product_id,
                   id,
                   category_id,
                   sub_category_id,
                   secondary_category_id,
                   price,
                   tax_included,
                   tax_rate,
                   group_id,
                   name,
                   online_price,
                   short_description,
                   long_description,
                   type_group,
                   supplier_id,
                   supplier_name,
                   image_url,
                   color,
                   size,
                   manufacturer_id)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _product_id=(
            self.product_id
            if hasattr(self, "product_id")
            else None
        )
        _id=(
            self.id
            if hasattr(self, "id")
            else None
        )
        _category_id=(
            self.category_id
            if hasattr(self, "category_id")
            else None
        )
        _sub_category_id=(
            self.sub_category_id
            if hasattr(self, "sub_category_id")
            else None
        )
        _secondary_category_id=(
            self.secondary_category_id
            if hasattr(self, "secondary_category_id")
            else None
        )
        _price=(
            self.price
            if hasattr(self, "price")
            else None
        )
        _tax_included=(
            self.tax_included
            if hasattr(self, "tax_included")
            else None
        )
        _tax_rate=(
            self.tax_rate
            if hasattr(self, "tax_rate")
            else None
        )
        _group_id=(
            self.group_id
            if hasattr(self, "group_id")
            else None
        )
        _name=(
            self.name
            if hasattr(self, "name")
            else None
        )
        _online_price=(
            self.online_price
            if hasattr(self, "online_price")
            else None
        )
        _short_description=(
            self.short_description
            if hasattr(self, "short_description")
            else None
        )
        _long_description=(
            self.long_description
            if hasattr(self, "long_description")
            else None
        )
        _type_group=(
            self.type_group
            if hasattr(self, "type_group")
            else None
        )
        _supplier_id=(
            self.supplier_id
            if hasattr(self, "supplier_id")
            else None
        )
        _supplier_name=(
            self.supplier_name
            if hasattr(self, "supplier_name")
            else None
        )
        _image_url=(
            self.image_url
            if hasattr(self, "image_url")
            else None
        )
        _color=(
            self.color
            if hasattr(self, "color")
            else None
        )
        _size=(
            self.size
            if hasattr(self, "size")
            else None
        )
        _manufacturer_id=(
            self.manufacturer_id
            if hasattr(self, "manufacturer_id")
            else None
        )
        return (
            f"{self.__class__.__name__}("
            f"product_id={_product_id!r}, "
            f"id={_id!r}, "
            f"category_id={_category_id!r}, "
            f"sub_category_id={_sub_category_id!r}, "
            f"secondary_category_id={_secondary_category_id!r}, "
            f"price={_price!r}, "
            f"tax_included={_tax_included!r}, "
            f"tax_rate={_tax_rate!r}, "
            f"group_id={_group_id!r}, "
            f"name={_name!r}, "
            f"online_price={_online_price!r}, "
            f"short_description={_short_description!r}, "
            f"long_description={_long_description!r}, "
            f"type_group={_type_group!r}, "
            f"supplier_id={_supplier_id!r}, "
            f"supplier_name={_supplier_name!r}, "
            f"image_url={_image_url!r}, "
            f"color={_color!r}, "
            f"size={_size!r}, "
            f"manufacturer_id={_manufacturer_id!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _product_id=(
            self.product_id
            if hasattr(self, "product_id")
            else None
        )
        _id=(
            self.id
            if hasattr(self, "id")
            else None
        )
        _category_id=(
            self.category_id
            if hasattr(self, "category_id")
            else None
        )
        _sub_category_id=(
            self.sub_category_id
            if hasattr(self, "sub_category_id")
            else None
        )
        _secondary_category_id=(
            self.secondary_category_id
            if hasattr(self, "secondary_category_id")
            else None
        )
        _price=(
            self.price
            if hasattr(self, "price")
            else None
        )
        _tax_included=(
            self.tax_included
            if hasattr(self, "tax_included")
            else None
        )
        _tax_rate=(
            self.tax_rate
            if hasattr(self, "tax_rate")
            else None
        )
        _group_id=(
            self.group_id
            if hasattr(self, "group_id")
            else None
        )
        _name=(
            self.name
            if hasattr(self, "name")
            else None
        )
        _online_price=(
            self.online_price
            if hasattr(self, "online_price")
            else None
        )
        _short_description=(
            self.short_description
            if hasattr(self, "short_description")
            else None
        )
        _long_description=(
            self.long_description
            if hasattr(self, "long_description")
            else None
        )
        _type_group=(
            self.type_group
            if hasattr(self, "type_group")
            else None
        )
        _supplier_id=(
            self.supplier_id
            if hasattr(self, "supplier_id")
            else None
        )
        _supplier_name=(
            self.supplier_name
            if hasattr(self, "supplier_name")
            else None
        )
        _image_url=(
            self.image_url
            if hasattr(self, "image_url")
            else None
        )
        _color=(
            self.color
            if hasattr(self, "color")
            else None
        )
        _size=(
            self.size
            if hasattr(self, "size")
            else None
        )
        _manufacturer_id=(
            self.manufacturer_id
            if hasattr(self, "manufacturer_id")
            else None
        )
        return (
            f"{self.__class__.__name__}("
            f"product_id={_product_id!s}, "
            f"id={_id!s}, "
            f"category_id={_category_id!s}, "
            f"sub_category_id={_sub_category_id!s}, "
            f"secondary_category_id={_secondary_category_id!s}, "
            f"price={_price!s}, "
            f"tax_included={_tax_included!s}, "
            f"tax_rate={_tax_rate!s}, "
            f"group_id={_group_id!s}, "
            f"name={_name!s}, "
            f"online_price={_online_price!s}, "
            f"short_description={_short_description!s}, "
            f"long_description={_long_description!s}, "
            f"type_group={_type_group!s}, "
            f"supplier_id={_supplier_id!s}, "
            f"supplier_name={_supplier_name!s}, "
            f"image_url={_image_url!s}, "
            f"color={_color!s}, "
            f"size={_size!s}, "
            f"manufacturer_id={_manufacturer_id!s}, "
            f")"
        )
