"""mindbodypublicapi.

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

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


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

    Update Product Request Model

    Attributes:
        barcode_id (str): The unique ID of the product variant, for example, a
            particular size and color combination.
        price (float): The price of the product.
        online_price (float): The online price of the product.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "barcode_id": "BarcodeId",
        "price": "Price",
        "online_price": "OnlinePrice",
    }

    _optionals = [
        "barcode_id",
        "price",
        "online_price",
    ]

    def __init__(
        self,
        barcode_id=APIHelper.SKIP,
        price=APIHelper.SKIP,
        online_price=APIHelper.SKIP):
        """Initialize a UpdateProductRequest instance."""
        # Initialize members of the class
        if barcode_id is not APIHelper.SKIP:
            self.barcode_id = barcode_id
        if price is not APIHelper.SKIP:
            self.price = price
        if online_price is not APIHelper.SKIP:
            self.online_price = online_price

    @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
        barcode_id =\
            dictionary.get("BarcodeId")\
            if dictionary.get("BarcodeId")\
                else APIHelper.SKIP
        price =\
            dictionary.get("Price")\
            if dictionary.get("Price")\
                else APIHelper.SKIP
        online_price =\
            dictionary.get("OnlinePrice")\
            if dictionary.get("OnlinePrice")\
                else APIHelper.SKIP

        # Return an object of this model
        return cls(barcode_id,
                   price,
                   online_price)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _barcode_id=(
            self.barcode_id
            if hasattr(self, "barcode_id")
            else None
        )
        _price=(
            self.price
            if hasattr(self, "price")
            else None
        )
        _online_price=(
            self.online_price
            if hasattr(self, "online_price")
            else None
        )
        return (
            f"{self.__class__.__name__}("
            f"barcode_id={_barcode_id!r}, "
            f"price={_price!r}, "
            f"online_price={_online_price!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _barcode_id=(
            self.barcode_id
            if hasattr(self, "barcode_id")
            else None
        )
        _price=(
            self.price
            if hasattr(self, "price")
            else None
        )
        _online_price=(
            self.online_price
            if hasattr(self, "online_price")
            else None
        )
        return (
            f"{self.__class__.__name__}("
            f"barcode_id={_barcode_id!s}, "
            f"price={_price!s}, "
            f"online_price={_online_price!s}, "
            f")"
        )
