"""mindbodypublicapi.

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

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


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

    Contains information about the pagination to use.

    Attributes:
        requested_limit (int): Limit from pagination request
        requested_offset (int): Offset from pagination request
        page_size (int): Number of results returned in this response
        total_results (int): Total number of results in dataset

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "requested_limit": "RequestedLimit",
        "requested_offset": "RequestedOffset",
        "page_size": "PageSize",
        "total_results": "TotalResults",
    }

    _optionals = [
        "requested_limit",
        "requested_offset",
        "page_size",
        "total_results",
    ]

    def __init__(
        self,
        requested_limit=APIHelper.SKIP,
        requested_offset=APIHelper.SKIP,
        page_size=APIHelper.SKIP,
        total_results=APIHelper.SKIP):
        """Initialize a PaginationResponse instance."""
        # Initialize members of the class
        if requested_limit is not APIHelper.SKIP:
            self.requested_limit = requested_limit
        if requested_offset is not APIHelper.SKIP:
            self.requested_offset = requested_offset
        if page_size is not APIHelper.SKIP:
            self.page_size = page_size
        if total_results is not APIHelper.SKIP:
            self.total_results = total_results

    @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
        requested_limit =\
            dictionary.get("RequestedLimit")\
            if dictionary.get("RequestedLimit")\
                else APIHelper.SKIP
        requested_offset =\
            dictionary.get("RequestedOffset")\
            if dictionary.get("RequestedOffset")\
                else APIHelper.SKIP
        page_size =\
            dictionary.get("PageSize")\
            if dictionary.get("PageSize")\
                else APIHelper.SKIP
        total_results =\
            dictionary.get("TotalResults")\
            if dictionary.get("TotalResults")\
                else APIHelper.SKIP

        # Return an object of this model
        return cls(requested_limit,
                   requested_offset,
                   page_size,
                   total_results)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _requested_limit=(
            self.requested_limit
            if hasattr(self, "requested_limit")
            else None
        )
        _requested_offset=(
            self.requested_offset
            if hasattr(self, "requested_offset")
            else None
        )
        _page_size=(
            self.page_size
            if hasattr(self, "page_size")
            else None
        )
        _total_results=(
            self.total_results
            if hasattr(self, "total_results")
            else None
        )
        return (
            f"{self.__class__.__name__}("
            f"requested_limit={_requested_limit!r}, "
            f"requested_offset={_requested_offset!r}, "
            f"page_size={_page_size!r}, "
            f"total_results={_total_results!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _requested_limit=(
            self.requested_limit
            if hasattr(self, "requested_limit")
            else None
        )
        _requested_offset=(
            self.requested_offset
            if hasattr(self, "requested_offset")
            else None
        )
        _page_size=(
            self.page_size
            if hasattr(self, "page_size")
            else None
        )
        _total_results=(
            self.total_results
            if hasattr(self, "total_results")
            else None
        )
        return (
            f"{self.__class__.__name__}("
            f"requested_limit={_requested_limit!s}, "
            f"requested_offset={_requested_offset!s}, "
            f"page_size={_page_size!s}, "
            f"total_results={_total_results!s}, "
            f")"
        )
