"""mindbodypublicapi.

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

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


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

    Attributes:
        product_id (int): A ProductId of the product.
        barcode_id (str): The Id is barcode Id of the product.
        location_id (int): The LocationId of the product.
        units_logged (int): UnitsLogged of the product.
        units_sold (int): UnitsSold of the product.
        units_in_stock (int): The units in stock of the product
        reorder_level (int): ReorderLevel of the product.
        max_level (int): MaxLevel of the product.
        created_date_time_utc (datetime): CreatedDateTimeUTC of the product.
        modified_date_time_utc (datetime): ModifiedDateTimeUTC of the product.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "product_id": "ProductId",
        "barcode_id": "BarcodeId",
        "location_id": "LocationId",
        "units_logged": "UnitsLogged",
        "units_sold": "UnitsSold",
        "units_in_stock": "UnitsInStock",
        "reorder_level": "ReorderLevel",
        "max_level": "MaxLevel",
        "created_date_time_utc": "CreatedDateTimeUTC",
        "modified_date_time_utc": "ModifiedDateTimeUTC",
    }

    _optionals = [
        "product_id",
        "barcode_id",
        "location_id",
        "units_logged",
        "units_sold",
        "units_in_stock",
        "reorder_level",
        "max_level",
        "created_date_time_utc",
        "modified_date_time_utc",
    ]

    def __init__(
        self,
        product_id=APIHelper.SKIP,
        barcode_id=APIHelper.SKIP,
        location_id=APIHelper.SKIP,
        units_logged=APIHelper.SKIP,
        units_sold=APIHelper.SKIP,
        units_in_stock=APIHelper.SKIP,
        reorder_level=APIHelper.SKIP,
        max_level=APIHelper.SKIP,
        created_date_time_utc=APIHelper.SKIP,
        modified_date_time_utc=APIHelper.SKIP):
        """Initialize a ProductsInventory instance."""
        # Initialize members of the class
        if product_id is not APIHelper.SKIP:
            self.product_id = product_id
        if barcode_id is not APIHelper.SKIP:
            self.barcode_id = barcode_id
        if location_id is not APIHelper.SKIP:
            self.location_id = location_id
        if units_logged is not APIHelper.SKIP:
            self.units_logged = units_logged
        if units_sold is not APIHelper.SKIP:
            self.units_sold = units_sold
        if units_in_stock is not APIHelper.SKIP:
            self.units_in_stock = units_in_stock
        if reorder_level is not APIHelper.SKIP:
            self.reorder_level = reorder_level
        if max_level is not APIHelper.SKIP:
            self.max_level = max_level
        if created_date_time_utc is not APIHelper.SKIP:
            self.created_date_time_utc =\
                 APIHelper.apply_datetime_converter(
                created_date_time_utc, APIHelper.RFC3339DateTime)\
                 if created_date_time_utc else None
        if modified_date_time_utc is not APIHelper.SKIP:
            self.modified_date_time_utc =\
                 APIHelper.apply_datetime_converter(
                modified_date_time_utc, APIHelper.RFC3339DateTime)\
                 if modified_date_time_utc else None

    @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
        barcode_id =\
            dictionary.get("BarcodeId")\
            if dictionary.get("BarcodeId")\
                else APIHelper.SKIP
        location_id =\
            dictionary.get("LocationId")\
            if dictionary.get("LocationId")\
                else APIHelper.SKIP
        units_logged =\
            dictionary.get("UnitsLogged")\
            if dictionary.get("UnitsLogged")\
                else APIHelper.SKIP
        units_sold =\
            dictionary.get("UnitsSold")\
            if dictionary.get("UnitsSold")\
                else APIHelper.SKIP
        units_in_stock =\
            dictionary.get("UnitsInStock")\
            if dictionary.get("UnitsInStock")\
                else APIHelper.SKIP
        reorder_level =\
            dictionary.get("ReorderLevel")\
            if dictionary.get("ReorderLevel")\
                else APIHelper.SKIP
        max_level =\
            dictionary.get("MaxLevel")\
            if dictionary.get("MaxLevel")\
                else APIHelper.SKIP
        created_date_time_utc = APIHelper.RFC3339DateTime.from_value(
            dictionary.get("CreatedDateTimeUTC")).datetime\
            if dictionary.get("CreatedDateTimeUTC") else APIHelper.SKIP
        modified_date_time_utc = APIHelper.RFC3339DateTime.from_value(
            dictionary.get("ModifiedDateTimeUTC")).datetime\
            if dictionary.get("ModifiedDateTimeUTC") else APIHelper.SKIP

        # Return an object of this model
        return cls(product_id,
                   barcode_id,
                   location_id,
                   units_logged,
                   units_sold,
                   units_in_stock,
                   reorder_level,
                   max_level,
                   created_date_time_utc,
                   modified_date_time_utc)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _product_id=(
            self.product_id
            if hasattr(self, "product_id")
            else None
        )
        _barcode_id=(
            self.barcode_id
            if hasattr(self, "barcode_id")
            else None
        )
        _location_id=(
            self.location_id
            if hasattr(self, "location_id")
            else None
        )
        _units_logged=(
            self.units_logged
            if hasattr(self, "units_logged")
            else None
        )
        _units_sold=(
            self.units_sold
            if hasattr(self, "units_sold")
            else None
        )
        _units_in_stock=(
            self.units_in_stock
            if hasattr(self, "units_in_stock")
            else None
        )
        _reorder_level=(
            self.reorder_level
            if hasattr(self, "reorder_level")
            else None
        )
        _max_level=(
            self.max_level
            if hasattr(self, "max_level")
            else None
        )
        _created_date_time_utc=(
            self.created_date_time_utc
            if hasattr(self, "created_date_time_utc")
            else None
        )
        _modified_date_time_utc=(
            self.modified_date_time_utc
            if hasattr(self, "modified_date_time_utc")
            else None
        )
        return (
            f"{self.__class__.__name__}("
            f"product_id={_product_id!r}, "
            f"barcode_id={_barcode_id!r}, "
            f"location_id={_location_id!r}, "
            f"units_logged={_units_logged!r}, "
            f"units_sold={_units_sold!r}, "
            f"units_in_stock={_units_in_stock!r}, "
            f"reorder_level={_reorder_level!r}, "
            f"max_level={_max_level!r}, "
            f"created_date_time_utc={_created_date_time_utc!r}, "
            f"modified_date_time_utc={_modified_date_time_utc!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _product_id=(
            self.product_id
            if hasattr(self, "product_id")
            else None
        )
        _barcode_id=(
            self.barcode_id
            if hasattr(self, "barcode_id")
            else None
        )
        _location_id=(
            self.location_id
            if hasattr(self, "location_id")
            else None
        )
        _units_logged=(
            self.units_logged
            if hasattr(self, "units_logged")
            else None
        )
        _units_sold=(
            self.units_sold
            if hasattr(self, "units_sold")
            else None
        )
        _units_in_stock=(
            self.units_in_stock
            if hasattr(self, "units_in_stock")
            else None
        )
        _reorder_level=(
            self.reorder_level
            if hasattr(self, "reorder_level")
            else None
        )
        _max_level=(
            self.max_level
            if hasattr(self, "max_level")
            else None
        )
        _created_date_time_utc=(
            self.created_date_time_utc
            if hasattr(self, "created_date_time_utc")
            else None
        )
        _modified_date_time_utc=(
            self.modified_date_time_utc
            if hasattr(self, "modified_date_time_utc")
            else None
        )
        return (
            f"{self.__class__.__name__}("
            f"product_id={_product_id!s}, "
            f"barcode_id={_barcode_id!s}, "
            f"location_id={_location_id!s}, "
            f"units_logged={_units_logged!s}, "
            f"units_sold={_units_sold!s}, "
            f"units_in_stock={_units_in_stock!s}, "
            f"reorder_level={_reorder_level!s}, "
            f"max_level={_max_level!s}, "
            f"created_date_time_utc={_created_date_time_utc!s}, "
            f"modified_date_time_utc={_modified_date_time_utc!s}, "
            f")"
        )
