"""mindbodypublicapi.

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

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


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

    The booking window for registration

    Attributes:
        start_date_time (datetime): Date and time that the booking window opens; that
            is, the first day of sales.
        end_date_time (datetime): Date and time that the booking window closes; that
            is, the last day of sales.
        daily_start_time (datetime): The time that the booking window opens; that is,
            the time that the store opens.
        daily_end_time (datetime): The time that the booking window closes; that is,
            the time that the store closes.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "start_date_time": "StartDateTime",
        "end_date_time": "EndDateTime",
        "daily_start_time": "DailyStartTime",
        "daily_end_time": "DailyEndTime",
    }

    _optionals = [
        "start_date_time",
        "end_date_time",
        "daily_start_time",
        "daily_end_time",
    ]

    def __init__(
        self,
        start_date_time=APIHelper.SKIP,
        end_date_time=APIHelper.SKIP,
        daily_start_time=APIHelper.SKIP,
        daily_end_time=APIHelper.SKIP):
        """Initialize a BookingWindow instance."""
        # Initialize members of the class
        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 daily_start_time is not APIHelper.SKIP:
            self.daily_start_time =\
                 APIHelper.apply_datetime_converter(
                daily_start_time, APIHelper.RFC3339DateTime)\
                 if daily_start_time else None
        if daily_end_time is not APIHelper.SKIP:
            self.daily_end_time =\
                 APIHelper.apply_datetime_converter(
                daily_end_time, APIHelper.RFC3339DateTime)\
                 if daily_end_time 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
        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
        daily_start_time = APIHelper.RFC3339DateTime.from_value(
            dictionary.get("DailyStartTime")).datetime\
            if dictionary.get("DailyStartTime") else APIHelper.SKIP
        daily_end_time = APIHelper.RFC3339DateTime.from_value(
            dictionary.get("DailyEndTime")).datetime\
            if dictionary.get("DailyEndTime") else APIHelper.SKIP

        # Return an object of this model
        return cls(start_date_time,
                   end_date_time,
                   daily_start_time,
                   daily_end_time)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _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
        )
        _daily_start_time=(
            self.daily_start_time
            if hasattr(self, "daily_start_time")
            else None
        )
        _daily_end_time=(
            self.daily_end_time
            if hasattr(self, "daily_end_time")
            else None
        )
        return (
            f"{self.__class__.__name__}("
            f"start_date_time={_start_date_time!r}, "
            f"end_date_time={_end_date_time!r}, "
            f"daily_start_time={_daily_start_time!r}, "
            f"daily_end_time={_daily_end_time!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _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
        )
        _daily_start_time=(
            self.daily_start_time
            if hasattr(self, "daily_start_time")
            else None
        )
        _daily_end_time=(
            self.daily_end_time
            if hasattr(self, "daily_end_time")
            else None
        )
        return (
            f"{self.__class__.__name__}("
            f"start_date_time={_start_date_time!s}, "
            f"end_date_time={_end_date_time!s}, "
            f"daily_start_time={_daily_start_time!s}, "
            f"daily_end_time={_daily_end_time!s}, "
            f")"
        )
