"""mindbodypublicapi.

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

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


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

    Contains information about the pagination used.

    Attributes:
        page_number (int): Page number of results in dataset.
        page_size (int): Number of results returned in this response.
        total_result_count (int): Total number of results in dataset.
        total_page_count (int): Total number of page in dataset.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "page_number": "PageNumber",
        "page_size": "PageSize",
        "total_result_count": "TotalResultCount",
        "total_page_count": "TotalPageCount",
    }

    _optionals = [
        "page_number",
        "page_size",
        "total_result_count",
        "total_page_count",
    ]

    def __init__(
        self,
        page_number=APIHelper.SKIP,
        page_size=APIHelper.SKIP,
        total_result_count=APIHelper.SKIP,
        total_page_count=APIHelper.SKIP):
        """Initialize a Pagination instance."""
        # Initialize members of the class
        if page_number is not APIHelper.SKIP:
            self.page_number = page_number
        if page_size is not APIHelper.SKIP:
            self.page_size = page_size
        if total_result_count is not APIHelper.SKIP:
            self.total_result_count = total_result_count
        if total_page_count is not APIHelper.SKIP:
            self.total_page_count = total_page_count

    @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
        page_number =\
            dictionary.get("PageNumber")\
            if dictionary.get("PageNumber")\
                else APIHelper.SKIP
        page_size =\
            dictionary.get("PageSize")\
            if dictionary.get("PageSize")\
                else APIHelper.SKIP
        total_result_count =\
            dictionary.get("TotalResultCount")\
            if dictionary.get("TotalResultCount")\
                else APIHelper.SKIP
        total_page_count =\
            dictionary.get("TotalPageCount")\
            if dictionary.get("TotalPageCount")\
                else APIHelper.SKIP

        # Return an object of this model
        return cls(page_number,
                   page_size,
                   total_result_count,
                   total_page_count)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _page_number=(
            self.page_number
            if hasattr(self, "page_number")
            else None
        )
        _page_size=(
            self.page_size
            if hasattr(self, "page_size")
            else None
        )
        _total_result_count=(
            self.total_result_count
            if hasattr(self, "total_result_count")
            else None
        )
        _total_page_count=(
            self.total_page_count
            if hasattr(self, "total_page_count")
            else None
        )
        return (
            f"{self.__class__.__name__}("
            f"page_number={_page_number!r}, "
            f"page_size={_page_size!r}, "
            f"total_result_count={_total_result_count!r}, "
            f"total_page_count={_total_page_count!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _page_number=(
            self.page_number
            if hasattr(self, "page_number")
            else None
        )
        _page_size=(
            self.page_size
            if hasattr(self, "page_size")
            else None
        )
        _total_result_count=(
            self.total_result_count
            if hasattr(self, "total_result_count")
            else None
        )
        _total_page_count=(
            self.total_page_count
            if hasattr(self, "total_page_count")
            else None
        )
        return (
            f"{self.__class__.__name__}("
            f"page_number={_page_number!s}, "
            f"page_size={_page_size!s}, "
            f"total_result_count={_total_result_count!s}, "
            f"total_page_count={_total_page_count!s}, "
            f")"
        )
