"""mindbodypublicapi.

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

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


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

    Get Semesters Request Model

    Attributes:
        semester_i_ds (List[int]): The requested semester IDs.
        start_date (datetime): The start date for the range. All semesters that are
            on or after this day.  Default: **today’s date**
        end_date (datetime): The end date for the range. All semesters that are on or
            before this day.  Default: **StartDate**
        active (bool): When true, the response only contains semesters which are
            activated. When false, only deactivated semesters are returned.  Default:
            **All semesters**
        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 = {
        "semester_i_ds": "SemesterIDs",
        "start_date": "StartDate",
        "end_date": "EndDate",
        "active": "Active",
        "limit": "Limit",
        "offset": "Offset",
    }

    _optionals = [
        "semester_i_ds",
        "start_date",
        "end_date",
        "active",
        "limit",
        "offset",
    ]

    def __init__(
        self,
        semester_i_ds=APIHelper.SKIP,
        start_date=APIHelper.SKIP,
        end_date=APIHelper.SKIP,
        active=APIHelper.SKIP,
        limit=APIHelper.SKIP,
        offset=APIHelper.SKIP):
        """Initialize a GetSemestersRequest instance."""
        # Initialize members of the class
        if semester_i_ds is not APIHelper.SKIP:
            self.semester_i_ds = semester_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 active is not APIHelper.SKIP:
            self.active = active
        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
        semester_i_ds =\
            dictionary.get("SemesterIDs")\
            if dictionary.get("SemesterIDs")\
                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
        active =\
            dictionary.get("Active")\
            if "Active" 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(semester_i_ds,
                   start_date,
                   end_date,
                   active,
                   limit,
                   offset)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _semester_i_ds=(
            self.semester_i_ds
            if hasattr(self, "semester_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
        )
        _active=(
            self.active
            if hasattr(self, "active")
            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"semester_i_ds={_semester_i_ds!r}, "
            f"start_date={_start_date!r}, "
            f"end_date={_end_date!r}, "
            f"active={_active!r}, "
            f"limit={_limit!r}, "
            f"offset={_offset!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _semester_i_ds=(
            self.semester_i_ds
            if hasattr(self, "semester_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
        )
        _active=(
            self.active
            if hasattr(self, "active")
            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"semester_i_ds={_semester_i_ds!s}, "
            f"start_date={_start_date!s}, "
            f"end_date={_end_date!s}, "
            f"active={_active!s}, "
            f"limit={_limit!s}, "
            f"offset={_offset!s}, "
            f")"
        )
