"""mindbodypublicapi.

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

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


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

    Attributes:
        location_ids (List[int]): A list of requested location IDs.
        staff_ids (List[int]): A list of requested staff IDs.
        start_date (datetime): The start date of the requested date range.   <br
            />Default: **today’s date**
        end_date (datetime): The end date of the requested date range.   <br
            />Default: **today’s date**
        ignore_prep_finish_times (bool): When `true`, appointment preparation and
            finish unavailabilities are not returned.   <br />Default: **false**
        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 = {
        "location_ids": "LocationIds",
        "staff_ids": "StaffIds",
        "start_date": "StartDate",
        "end_date": "EndDate",
        "ignore_prep_finish_times": "IgnorePrepFinishTimes",
        "limit": "Limit",
        "offset": "Offset",
    }

    _optionals = [
        "location_ids",
        "staff_ids",
        "start_date",
        "end_date",
        "ignore_prep_finish_times",
        "limit",
        "offset",
    ]

    def __init__(
        self,
        location_ids=APIHelper.SKIP,
        staff_ids=APIHelper.SKIP,
        start_date=APIHelper.SKIP,
        end_date=APIHelper.SKIP,
        ignore_prep_finish_times=APIHelper.SKIP,
        limit=APIHelper.SKIP,
        offset=APIHelper.SKIP):
        """Initialize a GetScheduleItemsRequest instance."""
        # Initialize members of the class
        if location_ids is not APIHelper.SKIP:
            self.location_ids = location_ids
        if staff_ids is not APIHelper.SKIP:
            self.staff_ids = staff_ids
        if start_date is not APIHelper.SKIP:
            self.start_date =\
                 APIHelper.apply_datetime_converter(
                start_date, APIHelper.RFC3339DateTime)\
                 if start_date else None
        if end_date is not APIHelper.SKIP:
            self.end_date =\
                 APIHelper.apply_datetime_converter(
                end_date, APIHelper.RFC3339DateTime)\
                 if end_date else None
        if ignore_prep_finish_times is not APIHelper.SKIP:
            self.ignore_prep_finish_times = ignore_prep_finish_times
        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
        location_ids =\
            dictionary.get("LocationIds")\
            if dictionary.get("LocationIds")\
                else APIHelper.SKIP
        staff_ids =\
            dictionary.get("StaffIds")\
            if dictionary.get("StaffIds")\
                else APIHelper.SKIP
        start_date = APIHelper.RFC3339DateTime.from_value(
            dictionary.get("StartDate")).datetime\
            if dictionary.get("StartDate") else APIHelper.SKIP
        end_date = APIHelper.RFC3339DateTime.from_value(
            dictionary.get("EndDate")).datetime\
            if dictionary.get("EndDate") else APIHelper.SKIP
        ignore_prep_finish_times =\
            dictionary.get("IgnorePrepFinishTimes")\
            if "IgnorePrepFinishTimes" in dictionary.keys()\
                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(location_ids,
                   staff_ids,
                   start_date,
                   end_date,
                   ignore_prep_finish_times,
                   limit,
                   offset)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _location_ids=(
            self.location_ids
            if hasattr(self, "location_ids")
            else None
        )
        _staff_ids=(
            self.staff_ids
            if hasattr(self, "staff_ids")
            else None
        )
        _start_date=(
            self.start_date
            if hasattr(self, "start_date")
            else None
        )
        _end_date=(
            self.end_date
            if hasattr(self, "end_date")
            else None
        )
        _ignore_prep_finish_times=(
            self.ignore_prep_finish_times
            if hasattr(self, "ignore_prep_finish_times")
            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"location_ids={_location_ids!r}, "
            f"staff_ids={_staff_ids!r}, "
            f"start_date={_start_date!r}, "
            f"end_date={_end_date!r}, "
            f"ignore_prep_finish_times={_ignore_prep_finish_times!r}, "
            f"limit={_limit!r}, "
            f"offset={_offset!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _location_ids=(
            self.location_ids
            if hasattr(self, "location_ids")
            else None
        )
        _staff_ids=(
            self.staff_ids
            if hasattr(self, "staff_ids")
            else None
        )
        _start_date=(
            self.start_date
            if hasattr(self, "start_date")
            else None
        )
        _end_date=(
            self.end_date
            if hasattr(self, "end_date")
            else None
        )
        _ignore_prep_finish_times=(
            self.ignore_prep_finish_times
            if hasattr(self, "ignore_prep_finish_times")
            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"location_ids={_location_ids!s}, "
            f"staff_ids={_staff_ids!s}, "
            f"start_date={_start_date!s}, "
            f"end_date={_end_date!s}, "
            f"ignore_prep_finish_times={_ignore_prep_finish_times!s}, "
            f"limit={_limit!s}, "
            f"offset={_offset!s}, "
            f")"
        )
