"""mindbodypublicapi.

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

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


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

    Attributes:
        staff_id (int): The ID of the staff member who taught the class.
        scheduled_service_id (int): The class' ID.
        scheduled_service_type (ScheduledServiceTypeEnum): The type of the scheduled
            service; i.e, a class, appointment, or enrollment.
        earnings (float): The total monetary amount the staff is to be paid for this
            class.
        date_time (datetime): The model property of type datetime.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "staff_id": "StaffId",
        "scheduled_service_id": "ScheduledServiceId",
        "scheduled_service_type": "ScheduledServiceType",
        "earnings": "Earnings",
        "date_time": "DateTime",
    }

    _optionals = [
        "staff_id",
        "scheduled_service_id",
        "scheduled_service_type",
        "earnings",
        "date_time",
    ]

    def __init__(
        self,
        staff_id=APIHelper.SKIP,
        scheduled_service_id=APIHelper.SKIP,
        scheduled_service_type=APIHelper.SKIP,
        earnings=APIHelper.SKIP,
        date_time=APIHelper.SKIP):
        """Initialize a ScheduledServiceEarningsEvent instance."""
        # Initialize members of the class
        if staff_id is not APIHelper.SKIP:
            self.staff_id = staff_id
        if scheduled_service_id is not APIHelper.SKIP:
            self.scheduled_service_id = scheduled_service_id
        if scheduled_service_type is not APIHelper.SKIP:
            self.scheduled_service_type = scheduled_service_type
        if earnings is not APIHelper.SKIP:
            self.earnings = earnings
        if date_time is not APIHelper.SKIP:
            self.date_time =\
                 APIHelper.apply_datetime_converter(
                date_time, APIHelper.RFC3339DateTime)\
                 if date_time else None

    @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
        staff_id =\
            dictionary.get("StaffId")\
            if dictionary.get("StaffId")\
                else APIHelper.SKIP
        scheduled_service_id =\
            dictionary.get("ScheduledServiceId")\
            if dictionary.get("ScheduledServiceId")\
                else APIHelper.SKIP
        scheduled_service_type =\
            dictionary.get("ScheduledServiceType")\
            if dictionary.get("ScheduledServiceType")\
                else APIHelper.SKIP
        earnings =\
            dictionary.get("Earnings")\
            if dictionary.get("Earnings")\
                else APIHelper.SKIP
        date_time = APIHelper.RFC3339DateTime.from_value(
            dictionary.get("DateTime")).datetime\
            if dictionary.get("DateTime") else APIHelper.SKIP

        # Return an object of this model
        return cls(staff_id,
                   scheduled_service_id,
                   scheduled_service_type,
                   earnings,
                   date_time)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _staff_id=(
            self.staff_id
            if hasattr(self, "staff_id")
            else None
        )
        _scheduled_service_id=(
            self.scheduled_service_id
            if hasattr(self, "scheduled_service_id")
            else None
        )
        _scheduled_service_type=(
            self.scheduled_service_type
            if hasattr(self, "scheduled_service_type")
            else None
        )
        _earnings=(
            self.earnings
            if hasattr(self, "earnings")
            else None
        )
        _date_time=(
            self.date_time
            if hasattr(self, "date_time")
            else None
        )
        return (
            f"{self.__class__.__name__}("
            f"staff_id={_staff_id!r}, "
            f"scheduled_service_id={_scheduled_service_id!r}, "
            f"scheduled_service_type={_scheduled_service_type!r}, "
            f"earnings={_earnings!r}, "
            f"date_time={_date_time!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _staff_id=(
            self.staff_id
            if hasattr(self, "staff_id")
            else None
        )
        _scheduled_service_id=(
            self.scheduled_service_id
            if hasattr(self, "scheduled_service_id")
            else None
        )
        _scheduled_service_type=(
            self.scheduled_service_type
            if hasattr(self, "scheduled_service_type")
            else None
        )
        _earnings=(
            self.earnings
            if hasattr(self, "earnings")
            else None
        )
        _date_time=(
            self.date_time
            if hasattr(self, "date_time")
            else None
        )
        return (
            f"{self.__class__.__name__}("
            f"staff_id={_staff_id!s}, "
            f"scheduled_service_id={_scheduled_service_id!s}, "
            f"scheduled_service_type={_scheduled_service_type!s}, "
            f"earnings={_earnings!s}, "
            f"date_time={_date_time!s}, "
            f")"
        )
