"""mindbodypublicapi.

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

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


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

    Attributes:
        session_type_id (int): required requested session type ID.
        location_id (int): optional requested location ID.
        staff_id (int): optional requested staff ID.
        start_date (datetime): The start date of the requested date range. If
            omitted, the default is used.  <br />Default: **today’s date**
        end_date (datetime): The end date of the requested date range.   <br
            />Default: **StartDate**

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "session_type_id": "SessionTypeId",
        "location_id": "LocationId",
        "staff_id": "StaffId",
        "start_date": "StartDate",
        "end_date": "EndDate",
    }

    _optionals = [
        "location_id",
        "staff_id",
        "start_date",
        "end_date",
    ]

    def __init__(
        self,
        session_type_id=None,
        location_id=APIHelper.SKIP,
        staff_id=APIHelper.SKIP,
        start_date=APIHelper.SKIP,
        end_date=APIHelper.SKIP):
        """Initialize a GetAvailableDatesRequest instance."""
        # Initialize members of the class
        self.session_type_id = session_type_id
        if location_id is not APIHelper.SKIP:
            self.location_id = location_id
        if staff_id is not APIHelper.SKIP:
            self.staff_id = staff_id
        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

    @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
        session_type_id =\
            dictionary.get("SessionTypeId")\
            if dictionary.get("SessionTypeId")\
                else None
        location_id =\
            dictionary.get("LocationId")\
            if dictionary.get("LocationId")\
                else APIHelper.SKIP
        staff_id =\
            dictionary.get("StaffId")\
            if dictionary.get("StaffId")\
                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

        # Return an object of this model
        return cls(session_type_id,
                   location_id,
                   staff_id,
                   start_date,
                   end_date)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _session_type_id=self.session_type_id
        _location_id=(
            self.location_id
            if hasattr(self, "location_id")
            else None
        )
        _staff_id=(
            self.staff_id
            if hasattr(self, "staff_id")
            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
        )
        return (
            f"{self.__class__.__name__}("
            f"session_type_id={_session_type_id!r}, "
            f"location_id={_location_id!r}, "
            f"staff_id={_staff_id!r}, "
            f"start_date={_start_date!r}, "
            f"end_date={_end_date!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _session_type_id=self.session_type_id
        _location_id=(
            self.location_id
            if hasattr(self, "location_id")
            else None
        )
        _staff_id=(
            self.staff_id
            if hasattr(self, "staff_id")
            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
        )
        return (
            f"{self.__class__.__name__}("
            f"session_type_id={_session_type_id!s}, "
            f"location_id={_location_id!s}, "
            f"staff_id={_staff_id!s}, "
            f"start_date={_start_date!s}, "
            f"end_date={_end_date!s}, "
            f")"
        )
