"""mindbodypublicapi.

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

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


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

    This is the request class for the get courses API

    Attributes:
        location_i_ds (List[int]): Return only courses that are available for the
            specified LocationIds.
        course_i_ds (List[int]): Return only courses that are available for the
            specified CourseIds.
        staff_i_ds (List[int]): Return only courses that are available for the
            specified StaffIds.
        program_i_ds (List[int]): Return only courses that are available for the
            specified ProgramIds.
        start_date (datetime): The start date range. Any active courses that are on
            or after this day.  <br />(optional) Defaults to today.
        end_date (datetime): The end date range. Any active courses that are on or
            before this day.  <br />(optional) Defaults to StartDate.
        semester_i_ds (List[int]): Return only courses that are available for the
            specified SemesterIds.
        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_i_ds": "LocationIDs",
        "course_i_ds": "CourseIDs",
        "staff_i_ds": "StaffIDs",
        "program_i_ds": "ProgramIDs",
        "start_date": "StartDate",
        "end_date": "EndDate",
        "semester_i_ds": "SemesterIDs",
        "limit": "Limit",
        "offset": "Offset",
    }

    _optionals = [
        "location_i_ds",
        "course_i_ds",
        "staff_i_ds",
        "program_i_ds",
        "start_date",
        "end_date",
        "semester_i_ds",
        "limit",
        "offset",
    ]

    def __init__(
        self,
        location_i_ds=APIHelper.SKIP,
        course_i_ds=APIHelper.SKIP,
        staff_i_ds=APIHelper.SKIP,
        program_i_ds=APIHelper.SKIP,
        start_date=APIHelper.SKIP,
        end_date=APIHelper.SKIP,
        semester_i_ds=APIHelper.SKIP,
        limit=APIHelper.SKIP,
        offset=APIHelper.SKIP):
        """Initialize a GetCoursesRequest instance."""
        # Initialize members of the class
        if location_i_ds is not APIHelper.SKIP:
            self.location_i_ds = location_i_ds
        if course_i_ds is not APIHelper.SKIP:
            self.course_i_ds = course_i_ds
        if staff_i_ds is not APIHelper.SKIP:
            self.staff_i_ds = staff_i_ds
        if program_i_ds is not APIHelper.SKIP:
            self.program_i_ds = program_i_ds
        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 semester_i_ds is not APIHelper.SKIP:
            self.semester_i_ds = semester_i_ds
        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_i_ds =\
            dictionary.get("LocationIDs")\
            if dictionary.get("LocationIDs")\
                else APIHelper.SKIP
        course_i_ds =\
            dictionary.get("CourseIDs")\
            if dictionary.get("CourseIDs")\
                else APIHelper.SKIP
        staff_i_ds =\
            dictionary.get("StaffIDs")\
            if dictionary.get("StaffIDs")\
                else APIHelper.SKIP
        program_i_ds =\
            dictionary.get("ProgramIDs")\
            if dictionary.get("ProgramIDs")\
                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
        semester_i_ds =\
            dictionary.get("SemesterIDs")\
            if dictionary.get("SemesterIDs")\
                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_i_ds,
                   course_i_ds,
                   staff_i_ds,
                   program_i_ds,
                   start_date,
                   end_date,
                   semester_i_ds,
                   limit,
                   offset)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _location_i_ds=(
            self.location_i_ds
            if hasattr(self, "location_i_ds")
            else None
        )
        _course_i_ds=(
            self.course_i_ds
            if hasattr(self, "course_i_ds")
            else None
        )
        _staff_i_ds=(
            self.staff_i_ds
            if hasattr(self, "staff_i_ds")
            else None
        )
        _program_i_ds=(
            self.program_i_ds
            if hasattr(self, "program_i_ds")
            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
        )
        _semester_i_ds=(
            self.semester_i_ds
            if hasattr(self, "semester_i_ds")
            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_i_ds={_location_i_ds!r}, "
            f"course_i_ds={_course_i_ds!r}, "
            f"staff_i_ds={_staff_i_ds!r}, "
            f"program_i_ds={_program_i_ds!r}, "
            f"start_date={_start_date!r}, "
            f"end_date={_end_date!r}, "
            f"semester_i_ds={_semester_i_ds!r}, "
            f"limit={_limit!r}, "
            f"offset={_offset!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _location_i_ds=(
            self.location_i_ds
            if hasattr(self, "location_i_ds")
            else None
        )
        _course_i_ds=(
            self.course_i_ds
            if hasattr(self, "course_i_ds")
            else None
        )
        _staff_i_ds=(
            self.staff_i_ds
            if hasattr(self, "staff_i_ds")
            else None
        )
        _program_i_ds=(
            self.program_i_ds
            if hasattr(self, "program_i_ds")
            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
        )
        _semester_i_ds=(
            self.semester_i_ds
            if hasattr(self, "semester_i_ds")
            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_i_ds={_location_i_ds!s}, "
            f"course_i_ds={_course_i_ds!s}, "
            f"staff_i_ds={_staff_i_ds!s}, "
            f"program_i_ds={_program_i_ds!s}, "
            f"start_date={_start_date!s}, "
            f"end_date={_end_date!s}, "
            f"semester_i_ds={_semester_i_ds!s}, "
            f"limit={_limit!s}, "
            f"offset={_offset!s}, "
            f")"
        )
