"""mindbodypublicapi.

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

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


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

    Attributes:
        schedule_type (ScheduleType1Enum): Filters on the provided the schedule type.
            Either `SessionTypeIds` or `ScheduleType` must be provided.
        session_type_ids (List[int]): Filters on the provided session type IDs.
            Either `SessionTypeIds` or `ScheduleType` must be provided.
        start_time (datetime): Filters results to times that start on or after this
            time on the current date. Any date provided is ignored.  <br />Default:
            **00:00:00**
        end_time (datetime): Filters results to times that end on or before this time
            on the current date. Any date provided is ignored..  <br />Default:
            **23:59:59**
        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 = {
        "schedule_type": "ScheduleType",
        "session_type_ids": "SessionTypeIds",
        "start_time": "StartTime",
        "end_time": "EndTime",
        "limit": "Limit",
        "offset": "Offset",
    }

    _optionals = [
        "schedule_type",
        "session_type_ids",
        "start_time",
        "end_time",
        "limit",
        "offset",
    ]

    def __init__(
        self,
        schedule_type=APIHelper.SKIP,
        session_type_ids=APIHelper.SKIP,
        start_time=APIHelper.SKIP,
        end_time=APIHelper.SKIP,
        limit=APIHelper.SKIP,
        offset=APIHelper.SKIP):
        """Initialize a GetActiveSessionTimesRequest instance."""
        # Initialize members of the class
        if schedule_type is not APIHelper.SKIP:
            self.schedule_type = schedule_type
        if session_type_ids is not APIHelper.SKIP:
            self.session_type_ids = session_type_ids
        if start_time is not APIHelper.SKIP:
            self.start_time =\
                 APIHelper.apply_datetime_converter(
                start_time, APIHelper.RFC3339DateTime)\
                 if start_time else None
        if end_time is not APIHelper.SKIP:
            self.end_time =\
                 APIHelper.apply_datetime_converter(
                end_time, APIHelper.RFC3339DateTime)\
                 if end_time else None
        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
        schedule_type =\
            dictionary.get("ScheduleType")\
            if dictionary.get("ScheduleType")\
                else APIHelper.SKIP
        session_type_ids =\
            dictionary.get("SessionTypeIds")\
            if dictionary.get("SessionTypeIds")\
                else APIHelper.SKIP
        start_time = APIHelper.RFC3339DateTime.from_value(
            dictionary.get("StartTime")).datetime\
            if dictionary.get("StartTime") else APIHelper.SKIP
        end_time = APIHelper.RFC3339DateTime.from_value(
            dictionary.get("EndTime")).datetime\
            if dictionary.get("EndTime") 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(schedule_type,
                   session_type_ids,
                   start_time,
                   end_time,
                   limit,
                   offset)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _schedule_type=(
            self.schedule_type
            if hasattr(self, "schedule_type")
            else None
        )
        _session_type_ids=(
            self.session_type_ids
            if hasattr(self, "session_type_ids")
            else None
        )
        _start_time=(
            self.start_time
            if hasattr(self, "start_time")
            else None
        )
        _end_time=(
            self.end_time
            if hasattr(self, "end_time")
            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"schedule_type={_schedule_type!r}, "
            f"session_type_ids={_session_type_ids!r}, "
            f"start_time={_start_time!r}, "
            f"end_time={_end_time!r}, "
            f"limit={_limit!r}, "
            f"offset={_offset!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _schedule_type=(
            self.schedule_type
            if hasattr(self, "schedule_type")
            else None
        )
        _session_type_ids=(
            self.session_type_ids
            if hasattr(self, "session_type_ids")
            else None
        )
        _start_time=(
            self.start_time
            if hasattr(self, "start_time")
            else None
        )
        _end_time=(
            self.end_time
            if hasattr(self, "end_time")
            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"schedule_type={_schedule_type!s}, "
            f"session_type_ids={_session_type_ids!s}, "
            f"start_time={_start_time!s}, "
            f"end_time={_end_time!s}, "
            f"limit={_limit!s}, "
            f"offset={_offset!s}, "
            f")"
        )
