"""mindbodypublicapi.

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

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


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

    Attributes:
        id (int): The ID of the unavailability.
        staff_id (int): Id of the staff
        start_date_time (datetime): The date and time the unavailability starts.
        end_date_time (datetime): The date and time the unavailability ends.
        description (str): A description of the unavailability.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "id": "Id",
        "staff_id": "StaffId",
        "start_date_time": "StartDateTime",
        "end_date_time": "EndDateTime",
        "description": "Description",
    }

    _optionals = [
        "id",
        "staff_id",
        "start_date_time",
        "end_date_time",
        "description",
    ]

    def __init__(
        self,
        id=APIHelper.SKIP,
        staff_id=APIHelper.SKIP,
        start_date_time=APIHelper.SKIP,
        end_date_time=APIHelper.SKIP,
        description=APIHelper.SKIP):
        """Initialize a UnavailabilityPlain instance."""
        # Initialize members of the class
        if id is not APIHelper.SKIP:
            self.id = id
        if staff_id is not APIHelper.SKIP:
            self.staff_id = staff_id
        if start_date_time is not APIHelper.SKIP:
            self.start_date_time =\
                 APIHelper.apply_datetime_converter(
                start_date_time, APIHelper.RFC3339DateTime)\
                 if start_date_time else None
        if end_date_time is not APIHelper.SKIP:
            self.end_date_time =\
                 APIHelper.apply_datetime_converter(
                end_date_time, APIHelper.RFC3339DateTime)\
                 if end_date_time else None
        if description is not APIHelper.SKIP:
            self.description = description

    @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
        id =\
            dictionary.get("Id")\
            if dictionary.get("Id")\
                else APIHelper.SKIP
        staff_id =\
            dictionary.get("StaffId")\
            if dictionary.get("StaffId")\
                else APIHelper.SKIP
        start_date_time = APIHelper.RFC3339DateTime.from_value(
            dictionary.get("StartDateTime")).datetime\
            if dictionary.get("StartDateTime") else APIHelper.SKIP
        end_date_time = APIHelper.RFC3339DateTime.from_value(
            dictionary.get("EndDateTime")).datetime\
            if dictionary.get("EndDateTime") else APIHelper.SKIP
        description =\
            dictionary.get("Description")\
            if dictionary.get("Description")\
                else APIHelper.SKIP

        # Return an object of this model
        return cls(id,
                   staff_id,
                   start_date_time,
                   end_date_time,
                   description)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _id=(
            self.id
            if hasattr(self, "id")
            else None
        )
        _staff_id=(
            self.staff_id
            if hasattr(self, "staff_id")
            else None
        )
        _start_date_time=(
            self.start_date_time
            if hasattr(self, "start_date_time")
            else None
        )
        _end_date_time=(
            self.end_date_time
            if hasattr(self, "end_date_time")
            else None
        )
        _description=(
            self.description
            if hasattr(self, "description")
            else None
        )
        return (
            f"{self.__class__.__name__}("
            f"id={_id!r}, "
            f"staff_id={_staff_id!r}, "
            f"start_date_time={_start_date_time!r}, "
            f"end_date_time={_end_date_time!r}, "
            f"description={_description!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _id=(
            self.id
            if hasattr(self, "id")
            else None
        )
        _staff_id=(
            self.staff_id
            if hasattr(self, "staff_id")
            else None
        )
        _start_date_time=(
            self.start_date_time
            if hasattr(self, "start_date_time")
            else None
        )
        _end_date_time=(
            self.end_date_time
            if hasattr(self, "end_date_time")
            else None
        )
        _description=(
            self.description
            if hasattr(self, "description")
            else None
        )
        return (
            f"{self.__class__.__name__}("
            f"id={_id!s}, "
            f"staff_id={_staff_id!s}, "
            f"start_date_time={_start_date_time!s}, "
            f"end_date_time={_end_date_time!s}, "
            f"description={_description!s}, "
            f")"
        )
