"""mindbodypublicapi.

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

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


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

    Attributes:
        package_ids (List[int]): A list of the packages IDs to filter by.
        sell_online (bool): When `true`, only returns products that can be sold
            online.<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 = {
        "package_ids": "PackageIds",
        "sell_online": "SellOnline",
        "location_id": "LocationId",
        "limit": "Limit",
        "offset": "Offset",
    }

    _optionals = [
        "package_ids",
        "sell_online",
        "location_id",
        "limit",
        "offset",
    ]

    def __init__(
        self,
        package_ids=APIHelper.SKIP,
        sell_online=APIHelper.SKIP,
        location_id=APIHelper.SKIP,
        limit=APIHelper.SKIP,
        offset=APIHelper.SKIP):
        """Initialize a GetPackagesRequest instance."""
        # Initialize members of the class
        if package_ids is not APIHelper.SKIP:
            self.package_ids = package_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
        package_ids =\
            dictionary.get("PackageIds")\
            if dictionary.get("PackageIds")\
                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(package_ids,
                   sell_online,
                   location_id,
                   limit,
                   offset)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _package_ids=(
            self.package_ids
            if hasattr(self, "package_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"package_ids={_package_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."""
        _package_ids=(
            self.package_ids
            if hasattr(self, "package_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"package_ids={_package_ids!s}, "
            f"sell_online={_sell_online!s}, "
            f"location_id={_location_id!s}, "
            f"limit={_limit!s}, "
            f"offset={_offset!s}, "
            f")"
        )
