"""mindbodypublicapi.

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

# ruff: noqa: E501
from mindbodypublicapi.api_helper import APIHelper
from mindbodypublicapi.models.pagination_response import (
    PaginationResponse,
)
from mindbodypublicapi.models.scheduled_service_earnings_event import (
    ScheduledServiceEarningsEvent,
)


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

    Attributes:
        pagination_response (PaginationResponse): Contains information about the
            pagination to use.
        scheduled_service_earnings (List[ScheduledServiceEarningsEvent]): Contains
            the class payroll events.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "pagination_response": "PaginationResponse",
        "scheduled_service_earnings": "ScheduledServiceEarnings",
    }

    _optionals = [
        "pagination_response",
        "scheduled_service_earnings",
    ]

    def __init__(
        self,
        pagination_response=APIHelper.SKIP,
        scheduled_service_earnings=APIHelper.SKIP):
        """Initialize a GetScheduledServiceEarningsResponse instance."""
        # Initialize members of the class
        if pagination_response is not APIHelper.SKIP:
            self.pagination_response = pagination_response
        if scheduled_service_earnings is not APIHelper.SKIP:
            self.scheduled_service_earnings = scheduled_service_earnings

    @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
        pagination_response =\
            PaginationResponse.from_dictionary(
                dictionary.get("PaginationResponse"))\
                if "PaginationResponse" in dictionary.keys()\
                else APIHelper.SKIP
        scheduled_service_earnings = None
        if dictionary.get("ScheduledServiceEarnings") is not None:
            scheduled_service_earnings = [
                ScheduledServiceEarningsEvent.from_dictionary(x)
                    for x in dictionary.get("ScheduledServiceEarnings")
            ]
        else:
            scheduled_service_earnings = APIHelper.SKIP

        # Return an object of this model
        return cls(pagination_response,
                   scheduled_service_earnings)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _pagination_response=(
            self.pagination_response
            if hasattr(self, "pagination_response")
            else None
        )
        _scheduled_service_earnings=(
            self.scheduled_service_earnings
            if hasattr(self, "scheduled_service_earnings")
            else None
        )
        return (
            f"{self.__class__.__name__}("
            f"pagination_response={_pagination_response!r}, "
            f"scheduled_service_earnings={_scheduled_service_earnings!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _pagination_response=(
            self.pagination_response
            if hasattr(self, "pagination_response")
            else None
        )
        _scheduled_service_earnings=(
            self.scheduled_service_earnings
            if hasattr(self, "scheduled_service_earnings")
            else None
        )
        return (
            f"{self.__class__.__name__}("
            f"pagination_response={_pagination_response!s}, "
            f"scheduled_service_earnings={_scheduled_service_earnings!s}, "
            f")"
        )
