"""mindbodypublicapi.

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

# ruff: noqa: E501
from mindbodypublicapi.api_helper import APIHelper
from mindbodypublicapi.models.class_description import (
    ClassDescription,
)
from mindbodypublicapi.models.client import (
    Client,
)
from mindbodypublicapi.models.course import (
    Course,
)
from mindbodypublicapi.models.location import (
    Location,
)
from mindbodypublicapi.models.mclass import (
    Class,
)
from mindbodypublicapi.models.staff import Staff


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

    Represents a single class instance. The class meets at the start time, goes until
    the end time.

    Attributes:
        classes (List[Class]): Contains information about a class.
        clients (List[Client]): Contains information about clients.
        course (Course): A course.
        semester_id (int): The semester ID for the enrollment (if any).
        is_available (bool): When `true`, indicates that the enrollment shows in
            consumer mode, has not started yet, and there is room in each class of
            the enrollment.<br />  When `false`, indicates that either the enrollment
            does not show in consumer mode, has already started, or there is no room
            in some classes of the enrollment.
        id (int): The unique ID of the class schedule.
        class_description (ClassDescription): Represents a class definition. The
            class meets at the start time, goes until the end time.
        day_sunday (bool): When `true`, indicates that this schedule occurs on
            Sundays.
        day_monday (bool): When `true`, indicates that this schedule occurs on
            Mondays.
        day_tuesday (bool): When `true`, indicates that this schedule occurs on
            Tuesdays.
        day_wednesday (bool): When `true`, indicates that this schedule occurs on
            Wednesdays.
        day_thursday (bool): When `true`, indicates that this schedule occurs on
            Thursdays.
        day_friday (bool): When `true`, indicates that this schedule occurs on
            Fridays.
        day_saturday (bool): When `true`, indicates that this schedule occurs on
            Saturdays.
        allow_open_enrollment (bool): When `true`, indicates that the enrollment
            allows booking after the enrollment has started.
        allow_date_forward_enrollment (bool): When `true`, indicates that this the
            enrollment shows in consumer mode, the enrollment has not started yet,
            and there is room in each class of the enrollment.
        start_time (datetime): The time this class schedule starts.
        end_time (datetime): The time this class schedule ends.
        start_date (datetime): The date this class schedule starts.
        end_date (datetime): The date this class schedule ends.
        staff (Staff): The Staff
        location (Location): The model property of type Location.
        frequency_type (FrequencyTypeEnum): The class schedule recurrence type.
        frequency_interval (int): The interval between class schedule occurencies.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "classes": "Classes",
        "clients": "Clients",
        "course": "Course",
        "semester_id": "SemesterId",
        "is_available": "IsAvailable",
        "id": "Id",
        "class_description": "ClassDescription",
        "day_sunday": "DaySunday",
        "day_monday": "DayMonday",
        "day_tuesday": "DayTuesday",
        "day_wednesday": "DayWednesday",
        "day_thursday": "DayThursday",
        "day_friday": "DayFriday",
        "day_saturday": "DaySaturday",
        "allow_open_enrollment": "AllowOpenEnrollment",
        "allow_date_forward_enrollment": "AllowDateForwardEnrollment",
        "start_time": "StartTime",
        "end_time": "EndTime",
        "start_date": "StartDate",
        "end_date": "EndDate",
        "staff": "Staff",
        "location": "Location",
        "frequency_type": "FrequencyType",
        "frequency_interval": "FrequencyInterval",
    }

    _optionals = [
        "classes",
        "clients",
        "course",
        "semester_id",
        "is_available",
        "id",
        "class_description",
        "day_sunday",
        "day_monday",
        "day_tuesday",
        "day_wednesday",
        "day_thursday",
        "day_friday",
        "day_saturday",
        "allow_open_enrollment",
        "allow_date_forward_enrollment",
        "start_time",
        "end_time",
        "start_date",
        "end_date",
        "staff",
        "location",
        "frequency_type",
        "frequency_interval",
    ]

    def __init__(
        self,
        classes=APIHelper.SKIP,
        clients=APIHelper.SKIP,
        course=APIHelper.SKIP,
        semester_id=APIHelper.SKIP,
        is_available=APIHelper.SKIP,
        id=APIHelper.SKIP,
        class_description=APIHelper.SKIP,
        day_sunday=APIHelper.SKIP,
        day_monday=APIHelper.SKIP,
        day_tuesday=APIHelper.SKIP,
        day_wednesday=APIHelper.SKIP,
        day_thursday=APIHelper.SKIP,
        day_friday=APIHelper.SKIP,
        day_saturday=APIHelper.SKIP,
        allow_open_enrollment=APIHelper.SKIP,
        allow_date_forward_enrollment=APIHelper.SKIP,
        start_time=APIHelper.SKIP,
        end_time=APIHelper.SKIP,
        start_date=APIHelper.SKIP,
        end_date=APIHelper.SKIP,
        staff=APIHelper.SKIP,
        location=APIHelper.SKIP,
        frequency_type=APIHelper.SKIP,
        frequency_interval=APIHelper.SKIP):
        """Initialize a ClassSchedule instance."""
        # Initialize members of the class
        if classes is not APIHelper.SKIP:
            self.classes = classes
        if clients is not APIHelper.SKIP:
            self.clients = clients
        if course is not APIHelper.SKIP:
            self.course = course
        if semester_id is not APIHelper.SKIP:
            self.semester_id = semester_id
        if is_available is not APIHelper.SKIP:
            self.is_available = is_available
        if id is not APIHelper.SKIP:
            self.id = id
        if class_description is not APIHelper.SKIP:
            self.class_description = class_description
        if day_sunday is not APIHelper.SKIP:
            self.day_sunday = day_sunday
        if day_monday is not APIHelper.SKIP:
            self.day_monday = day_monday
        if day_tuesday is not APIHelper.SKIP:
            self.day_tuesday = day_tuesday
        if day_wednesday is not APIHelper.SKIP:
            self.day_wednesday = day_wednesday
        if day_thursday is not APIHelper.SKIP:
            self.day_thursday = day_thursday
        if day_friday is not APIHelper.SKIP:
            self.day_friday = day_friday
        if day_saturday is not APIHelper.SKIP:
            self.day_saturday = day_saturday
        if allow_open_enrollment is not APIHelper.SKIP:
            self.allow_open_enrollment = allow_open_enrollment
        if allow_date_forward_enrollment is not APIHelper.SKIP:
            self.allow_date_forward_enrollment = allow_date_forward_enrollment
        if start_time is not APIHelper.SKIP:
            self.start_time =\
                 APIHelper.apply_datetime_converter(
                start_time, APIHelper.RFC3339DateTime)\
                 if start_time else None
        if end_time is not APIHelper.SKIP:
            self.end_time =\
                 APIHelper.apply_datetime_converter(
                end_time, APIHelper.RFC3339DateTime)\
                 if end_time else None
        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 staff is not APIHelper.SKIP:
            self.staff = staff
        if location is not APIHelper.SKIP:
            self.location = location
        if frequency_type is not APIHelper.SKIP:
            self.frequency_type = frequency_type
        if frequency_interval is not APIHelper.SKIP:
            self.frequency_interval = frequency_interval

    @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
        classes = None
        if dictionary.get("Classes") is not None:
            classes = [
                Class.from_dictionary(x)
                    for x in dictionary.get("Classes")
            ]
        else:
            classes = APIHelper.SKIP
        clients = None
        if dictionary.get("Clients") is not None:
            clients = [
                Client.from_dictionary(x)
                    for x in dictionary.get("Clients")
            ]
        else:
            clients = APIHelper.SKIP
        course =\
            Course.from_dictionary(
                dictionary.get("Course"))\
                if "Course" in dictionary.keys()\
                else APIHelper.SKIP
        semester_id =\
            dictionary.get("SemesterId")\
            if dictionary.get("SemesterId")\
                else APIHelper.SKIP
        is_available =\
            dictionary.get("IsAvailable")\
            if "IsAvailable" in dictionary.keys()\
                else APIHelper.SKIP
        id =\
            dictionary.get("Id")\
            if dictionary.get("Id")\
                else APIHelper.SKIP
        class_description =\
            ClassDescription.from_dictionary(
                dictionary.get("ClassDescription"))\
                if "ClassDescription" in dictionary.keys()\
                else APIHelper.SKIP
        day_sunday =\
            dictionary.get("DaySunday")\
            if "DaySunday" in dictionary.keys()\
                else APIHelper.SKIP
        day_monday =\
            dictionary.get("DayMonday")\
            if "DayMonday" in dictionary.keys()\
                else APIHelper.SKIP
        day_tuesday =\
            dictionary.get("DayTuesday")\
            if "DayTuesday" in dictionary.keys()\
                else APIHelper.SKIP
        day_wednesday =\
            dictionary.get("DayWednesday")\
            if "DayWednesday" in dictionary.keys()\
                else APIHelper.SKIP
        day_thursday =\
            dictionary.get("DayThursday")\
            if "DayThursday" in dictionary.keys()\
                else APIHelper.SKIP
        day_friday =\
            dictionary.get("DayFriday")\
            if "DayFriday" in dictionary.keys()\
                else APIHelper.SKIP
        day_saturday =\
            dictionary.get("DaySaturday")\
            if "DaySaturday" in dictionary.keys()\
                else APIHelper.SKIP
        allow_open_enrollment =\
            dictionary.get("AllowOpenEnrollment")\
            if "AllowOpenEnrollment" in dictionary.keys()\
                else APIHelper.SKIP
        allow_date_forward_enrollment =\
            dictionary.get("AllowDateForwardEnrollment")\
            if "AllowDateForwardEnrollment" in dictionary.keys()\
                else APIHelper.SKIP
        start_time = APIHelper.RFC3339DateTime.from_value(
            dictionary.get("StartTime")).datetime\
            if dictionary.get("StartTime") else APIHelper.SKIP
        end_time = APIHelper.RFC3339DateTime.from_value(
            dictionary.get("EndTime")).datetime\
            if dictionary.get("EndTime") 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
        staff =\
            Staff.from_dictionary(
                dictionary.get("Staff"))\
                if "Staff" in dictionary.keys()\
                else APIHelper.SKIP
        location =\
            Location.from_dictionary(
                dictionary.get("Location"))\
                if "Location" in dictionary.keys()\
                else APIHelper.SKIP
        frequency_type =\
            dictionary.get("FrequencyType")\
            if dictionary.get("FrequencyType")\
                else APIHelper.SKIP
        frequency_interval =\
            dictionary.get("FrequencyInterval")\
            if dictionary.get("FrequencyInterval")\
                else APIHelper.SKIP

        # Return an object of this model
        return cls(classes,
                   clients,
                   course,
                   semester_id,
                   is_available,
                   id,
                   class_description,
                   day_sunday,
                   day_monday,
                   day_tuesday,
                   day_wednesday,
                   day_thursday,
                   day_friday,
                   day_saturday,
                   allow_open_enrollment,
                   allow_date_forward_enrollment,
                   start_time,
                   end_time,
                   start_date,
                   end_date,
                   staff,
                   location,
                   frequency_type,
                   frequency_interval)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _classes=(
            self.classes
            if hasattr(self, "classes")
            else None
        )
        _clients=(
            self.clients
            if hasattr(self, "clients")
            else None
        )
        _course=(
            self.course
            if hasattr(self, "course")
            else None
        )
        _semester_id=(
            self.semester_id
            if hasattr(self, "semester_id")
            else None
        )
        _is_available=(
            self.is_available
            if hasattr(self, "is_available")
            else None
        )
        _id=(
            self.id
            if hasattr(self, "id")
            else None
        )
        _class_description=(
            self.class_description
            if hasattr(self, "class_description")
            else None
        )
        _day_sunday=(
            self.day_sunday
            if hasattr(self, "day_sunday")
            else None
        )
        _day_monday=(
            self.day_monday
            if hasattr(self, "day_monday")
            else None
        )
        _day_tuesday=(
            self.day_tuesday
            if hasattr(self, "day_tuesday")
            else None
        )
        _day_wednesday=(
            self.day_wednesday
            if hasattr(self, "day_wednesday")
            else None
        )
        _day_thursday=(
            self.day_thursday
            if hasattr(self, "day_thursday")
            else None
        )
        _day_friday=(
            self.day_friday
            if hasattr(self, "day_friday")
            else None
        )
        _day_saturday=(
            self.day_saturday
            if hasattr(self, "day_saturday")
            else None
        )
        _allow_open_enrollment=(
            self.allow_open_enrollment
            if hasattr(self, "allow_open_enrollment")
            else None
        )
        _allow_date_forward_enrollment=(
            self.allow_date_forward_enrollment
            if hasattr(self, "allow_date_forward_enrollment")
            else None
        )
        _start_time=(
            self.start_time
            if hasattr(self, "start_time")
            else None
        )
        _end_time=(
            self.end_time
            if hasattr(self, "end_time")
            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
        )
        _staff=(
            self.staff
            if hasattr(self, "staff")
            else None
        )
        _location=(
            self.location
            if hasattr(self, "location")
            else None
        )
        _frequency_type=(
            self.frequency_type
            if hasattr(self, "frequency_type")
            else None
        )
        _frequency_interval=(
            self.frequency_interval
            if hasattr(self, "frequency_interval")
            else None
        )
        return (
            f"{self.__class__.__name__}("
            f"classes={_classes!r}, "
            f"clients={_clients!r}, "
            f"course={_course!r}, "
            f"semester_id={_semester_id!r}, "
            f"is_available={_is_available!r}, "
            f"id={_id!r}, "
            f"class_description={_class_description!r}, "
            f"day_sunday={_day_sunday!r}, "
            f"day_monday={_day_monday!r}, "
            f"day_tuesday={_day_tuesday!r}, "
            f"day_wednesday={_day_wednesday!r}, "
            f"day_thursday={_day_thursday!r}, "
            f"day_friday={_day_friday!r}, "
            f"day_saturday={_day_saturday!r}, "
            f"allow_open_enrollment={_allow_open_enrollment!r}, "
            f"allow_date_forward_enrollment={_allow_date_forward_enrollment!r}, "
            f"start_time={_start_time!r}, "
            f"end_time={_end_time!r}, "
            f"start_date={_start_date!r}, "
            f"end_date={_end_date!r}, "
            f"staff={_staff!r}, "
            f"location={_location!r}, "
            f"frequency_type={_frequency_type!r}, "
            f"frequency_interval={_frequency_interval!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _classes=(
            self.classes
            if hasattr(self, "classes")
            else None
        )
        _clients=(
            self.clients
            if hasattr(self, "clients")
            else None
        )
        _course=(
            self.course
            if hasattr(self, "course")
            else None
        )
        _semester_id=(
            self.semester_id
            if hasattr(self, "semester_id")
            else None
        )
        _is_available=(
            self.is_available
            if hasattr(self, "is_available")
            else None
        )
        _id=(
            self.id
            if hasattr(self, "id")
            else None
        )
        _class_description=(
            self.class_description
            if hasattr(self, "class_description")
            else None
        )
        _day_sunday=(
            self.day_sunday
            if hasattr(self, "day_sunday")
            else None
        )
        _day_monday=(
            self.day_monday
            if hasattr(self, "day_monday")
            else None
        )
        _day_tuesday=(
            self.day_tuesday
            if hasattr(self, "day_tuesday")
            else None
        )
        _day_wednesday=(
            self.day_wednesday
            if hasattr(self, "day_wednesday")
            else None
        )
        _day_thursday=(
            self.day_thursday
            if hasattr(self, "day_thursday")
            else None
        )
        _day_friday=(
            self.day_friday
            if hasattr(self, "day_friday")
            else None
        )
        _day_saturday=(
            self.day_saturday
            if hasattr(self, "day_saturday")
            else None
        )
        _allow_open_enrollment=(
            self.allow_open_enrollment
            if hasattr(self, "allow_open_enrollment")
            else None
        )
        _allow_date_forward_enrollment=(
            self.allow_date_forward_enrollment
            if hasattr(self, "allow_date_forward_enrollment")
            else None
        )
        _start_time=(
            self.start_time
            if hasattr(self, "start_time")
            else None
        )
        _end_time=(
            self.end_time
            if hasattr(self, "end_time")
            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
        )
        _staff=(
            self.staff
            if hasattr(self, "staff")
            else None
        )
        _location=(
            self.location
            if hasattr(self, "location")
            else None
        )
        _frequency_type=(
            self.frequency_type
            if hasattr(self, "frequency_type")
            else None
        )
        _frequency_interval=(
            self.frequency_interval
            if hasattr(self, "frequency_interval")
            else None
        )
        return (
            f"{self.__class__.__name__}("
            f"classes={_classes!s}, "
            f"clients={_clients!s}, "
            f"course={_course!s}, "
            f"semester_id={_semester_id!s}, "
            f"is_available={_is_available!s}, "
            f"id={_id!s}, "
            f"class_description={_class_description!s}, "
            f"day_sunday={_day_sunday!s}, "
            f"day_monday={_day_monday!s}, "
            f"day_tuesday={_day_tuesday!s}, "
            f"day_wednesday={_day_wednesday!s}, "
            f"day_thursday={_day_thursday!s}, "
            f"day_friday={_day_friday!s}, "
            f"day_saturday={_day_saturday!s}, "
            f"allow_open_enrollment={_allow_open_enrollment!s}, "
            f"allow_date_forward_enrollment={_allow_date_forward_enrollment!s}, "
            f"start_time={_start_time!s}, "
            f"end_time={_end_time!s}, "
            f"start_date={_start_date!s}, "
            f"end_date={_end_date!s}, "
            f"staff={_staff!s}, "
            f"location={_location!s}, "
            f"frequency_type={_frequency_type!s}, "
            f"frequency_interval={_frequency_interval!s}, "
            f")"
        )
