"""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.booking_window import (
    BookingWindow,
)
from mindbodypublicapi.models.class_description import (
    ClassDescription,
)
from mindbodypublicapi.models.client import (
    Client,
)
from mindbodypublicapi.models.location import (
    Location,
)
from mindbodypublicapi.models.resource_slim import (
    ResourceSlim,
)
from mindbodypublicapi.models.staff import Staff
from mindbodypublicapi.models.visit import Visit


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

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

    Attributes:
        class_schedule_id (int): The ID used to retrieve the class schedule for the
            desired class.
        visits (List[Visit]): Contains information about visits.
        clients (List[Client]): Contains information about clients.
        location (Location): The model property of type Location.
        resource (ResourceSlim): Contains information about resources, such as rooms.
        max_capacity (int): The maximum number of clients allowed in the class.
        web_capacity (int): The maximum number of clients allowed to sign up online
            for the class.
        total_booked (int): The total number of clients booked in the class.
        total_signed_in (int): The total number of clients signed into the class.
        total_booked_waitlist (int): The total number of booked clients on the
            waiting list for the class.
        web_booked (int): The total number of clients who signed up online for the
            class.
        semester_id (int): The ID of the semester that the class is a part of, if any.
        is_canceled (bool): When `true`, indicates that the class has been
            cancelled.<br />  When `false`, indicates that the class has not been
            cancelled.
        substitute (bool): When `true`, indicates that the class is being taught by a
            substitute teacher.<br />  When `false`, indicates that the class is
            being taught by its regular teacher.
        active (bool): When `true`, indicates that the class is shown to clients when
            in consumer mode.<br />  When `false`, indicates that the class is not
            shown to clients when in consumer mode.
        is_waitlist_available (bool): When `true`, indicates that the clients can be
            placed on a waiting list for the class.<br />  When `false`, indicates
            that the clients cannot be placed on a waiting list for the class.
        is_enrolled (bool): When `true`, indicates that the client with the given
            `ClientId` is enrolled in this class.<br />  When `false`, indicates that
            the client with the given `ClientId` is not enrolled in this class.
        hide_cancel (bool): When `true`, indicates that this class is hidden when
            cancelled.<br />  When `false`, indicates that this class is not hidden
            when cancelled.
        id (int): The unique identifier for the class.
        is_available (bool): When `true`, indicates that the client with the given
            client ID can book this class.<br />  When `false`, indicates that the
            client with the given client ID cannot book this class.
        start_date_time (datetime): The time this class is scheduled to start.
        end_date_time (datetime): The time this class is scheduled to end.
        last_modified_date_time (datetime): The last time this class was modified.
        class_description (ClassDescription): Represents a class definition. The
            class meets at the start time, goes until the end time.
        staff (Staff): The Staff
        booking_window (BookingWindow): The booking window for registration
        booking_status (BookingStatusEnum): Contains the booking’s payment status.
        virtual_stream_link (str): The link to the Mindbody-hosted live stream for
            the class. This is `null` when no live stream is configured for the class.
        wait_list_size (int): The maximum number allowed on the waiting list for the
            class.
        class_notes (str): Notes for the class

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "class_schedule_id": "ClassScheduleId",
        "visits": "Visits",
        "clients": "Clients",
        "location": "Location",
        "resource": "Resource",
        "max_capacity": "MaxCapacity",
        "web_capacity": "WebCapacity",
        "total_booked": "TotalBooked",
        "total_signed_in": "TotalSignedIn",
        "total_booked_waitlist": "TotalBookedWaitlist",
        "web_booked": "WebBooked",
        "semester_id": "SemesterId",
        "is_canceled": "IsCanceled",
        "substitute": "Substitute",
        "active": "Active",
        "is_waitlist_available": "IsWaitlistAvailable",
        "is_enrolled": "IsEnrolled",
        "hide_cancel": "HideCancel",
        "id": "Id",
        "is_available": "IsAvailable",
        "start_date_time": "StartDateTime",
        "end_date_time": "EndDateTime",
        "last_modified_date_time": "LastModifiedDateTime",
        "class_description": "ClassDescription",
        "staff": "Staff",
        "booking_window": "BookingWindow",
        "booking_status": "BookingStatus",
        "virtual_stream_link": "VirtualStreamLink",
        "wait_list_size": "WaitListSize",
        "class_notes": "ClassNotes",
    }

    _optionals = [
        "class_schedule_id",
        "visits",
        "clients",
        "location",
        "resource",
        "max_capacity",
        "web_capacity",
        "total_booked",
        "total_signed_in",
        "total_booked_waitlist",
        "web_booked",
        "semester_id",
        "is_canceled",
        "substitute",
        "active",
        "is_waitlist_available",
        "is_enrolled",
        "hide_cancel",
        "id",
        "is_available",
        "start_date_time",
        "end_date_time",
        "last_modified_date_time",
        "class_description",
        "staff",
        "booking_window",
        "booking_status",
        "virtual_stream_link",
        "wait_list_size",
        "class_notes",
    ]

    def __init__(
        self,
        class_schedule_id=APIHelper.SKIP,
        visits=APIHelper.SKIP,
        clients=APIHelper.SKIP,
        location=APIHelper.SKIP,
        resource=APIHelper.SKIP,
        max_capacity=APIHelper.SKIP,
        web_capacity=APIHelper.SKIP,
        total_booked=APIHelper.SKIP,
        total_signed_in=APIHelper.SKIP,
        total_booked_waitlist=APIHelper.SKIP,
        web_booked=APIHelper.SKIP,
        semester_id=APIHelper.SKIP,
        is_canceled=APIHelper.SKIP,
        substitute=APIHelper.SKIP,
        active=APIHelper.SKIP,
        is_waitlist_available=APIHelper.SKIP,
        is_enrolled=APIHelper.SKIP,
        hide_cancel=APIHelper.SKIP,
        id=APIHelper.SKIP,
        is_available=APIHelper.SKIP,
        start_date_time=APIHelper.SKIP,
        end_date_time=APIHelper.SKIP,
        last_modified_date_time=APIHelper.SKIP,
        class_description=APIHelper.SKIP,
        staff=APIHelper.SKIP,
        booking_window=APIHelper.SKIP,
        booking_status=APIHelper.SKIP,
        virtual_stream_link=APIHelper.SKIP,
        wait_list_size=APIHelper.SKIP,
        class_notes=APIHelper.SKIP):
        """Initialize a Class instance."""
        # Initialize members of the class
        if class_schedule_id is not APIHelper.SKIP:
            self.class_schedule_id = class_schedule_id
        if visits is not APIHelper.SKIP:
            self.visits = visits
        if clients is not APIHelper.SKIP:
            self.clients = clients
        if location is not APIHelper.SKIP:
            self.location = location
        if resource is not APIHelper.SKIP:
            self.resource = resource
        if max_capacity is not APIHelper.SKIP:
            self.max_capacity = max_capacity
        if web_capacity is not APIHelper.SKIP:
            self.web_capacity = web_capacity
        if total_booked is not APIHelper.SKIP:
            self.total_booked = total_booked
        if total_signed_in is not APIHelper.SKIP:
            self.total_signed_in = total_signed_in
        if total_booked_waitlist is not APIHelper.SKIP:
            self.total_booked_waitlist = total_booked_waitlist
        if web_booked is not APIHelper.SKIP:
            self.web_booked = web_booked
        if semester_id is not APIHelper.SKIP:
            self.semester_id = semester_id
        if is_canceled is not APIHelper.SKIP:
            self.is_canceled = is_canceled
        if substitute is not APIHelper.SKIP:
            self.substitute = substitute
        if active is not APIHelper.SKIP:
            self.active = active
        if is_waitlist_available is not APIHelper.SKIP:
            self.is_waitlist_available = is_waitlist_available
        if is_enrolled is not APIHelper.SKIP:
            self.is_enrolled = is_enrolled
        if hide_cancel is not APIHelper.SKIP:
            self.hide_cancel = hide_cancel
        if id is not APIHelper.SKIP:
            self.id = id
        if is_available is not APIHelper.SKIP:
            self.is_available = is_available
        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 last_modified_date_time is not APIHelper.SKIP:
            self.last_modified_date_time =\
                 APIHelper.apply_datetime_converter(
                last_modified_date_time, APIHelper.RFC3339DateTime)\
                 if last_modified_date_time else None
        if class_description is not APIHelper.SKIP:
            self.class_description = class_description
        if staff is not APIHelper.SKIP:
            self.staff = staff
        if booking_window is not APIHelper.SKIP:
            self.booking_window = booking_window
        if booking_status is not APIHelper.SKIP:
            self.booking_status = booking_status
        if virtual_stream_link is not APIHelper.SKIP:
            self.virtual_stream_link = virtual_stream_link
        if wait_list_size is not APIHelper.SKIP:
            self.wait_list_size = wait_list_size
        if class_notes is not APIHelper.SKIP:
            self.class_notes = class_notes

    @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
        class_schedule_id =\
            dictionary.get("ClassScheduleId")\
            if dictionary.get("ClassScheduleId")\
                else APIHelper.SKIP
        visits = None
        if dictionary.get("Visits") is not None:
            visits = [
                Visit.from_dictionary(x)
                    for x in dictionary.get("Visits")
            ]
        else:
            visits = 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
        location =\
            Location.from_dictionary(
                dictionary.get("Location"))\
                if "Location" in dictionary.keys()\
                else APIHelper.SKIP
        resource =\
            ResourceSlim.from_dictionary(
                dictionary.get("Resource"))\
                if "Resource" in dictionary.keys()\
                else APIHelper.SKIP
        max_capacity =\
            dictionary.get("MaxCapacity")\
            if dictionary.get("MaxCapacity")\
                else APIHelper.SKIP
        web_capacity =\
            dictionary.get("WebCapacity")\
            if dictionary.get("WebCapacity")\
                else APIHelper.SKIP
        total_booked =\
            dictionary.get("TotalBooked")\
            if dictionary.get("TotalBooked")\
                else APIHelper.SKIP
        total_signed_in =\
            dictionary.get("TotalSignedIn")\
            if dictionary.get("TotalSignedIn")\
                else APIHelper.SKIP
        total_booked_waitlist =\
            dictionary.get("TotalBookedWaitlist")\
            if dictionary.get("TotalBookedWaitlist")\
                else APIHelper.SKIP
        web_booked =\
            dictionary.get("WebBooked")\
            if dictionary.get("WebBooked")\
                else APIHelper.SKIP
        semester_id =\
            dictionary.get("SemesterId")\
            if dictionary.get("SemesterId")\
                else APIHelper.SKIP
        is_canceled =\
            dictionary.get("IsCanceled")\
            if "IsCanceled" in dictionary.keys()\
                else APIHelper.SKIP
        substitute =\
            dictionary.get("Substitute")\
            if "Substitute" in dictionary.keys()\
                else APIHelper.SKIP
        active =\
            dictionary.get("Active")\
            if "Active" in dictionary.keys()\
                else APIHelper.SKIP
        is_waitlist_available =\
            dictionary.get("IsWaitlistAvailable")\
            if "IsWaitlistAvailable" in dictionary.keys()\
                else APIHelper.SKIP
        is_enrolled =\
            dictionary.get("IsEnrolled")\
            if "IsEnrolled" in dictionary.keys()\
                else APIHelper.SKIP
        hide_cancel =\
            dictionary.get("HideCancel")\
            if "HideCancel" in dictionary.keys()\
                else APIHelper.SKIP
        id =\
            dictionary.get("Id")\
            if dictionary.get("Id")\
                else APIHelper.SKIP
        is_available =\
            dictionary.get("IsAvailable")\
            if "IsAvailable" in dictionary.keys()\
                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
        last_modified_date_time = APIHelper.RFC3339DateTime.from_value(
            dictionary.get("LastModifiedDateTime")).datetime\
            if dictionary.get("LastModifiedDateTime") else APIHelper.SKIP
        class_description =\
            ClassDescription.from_dictionary(
                dictionary.get("ClassDescription"))\
                if "ClassDescription" in dictionary.keys()\
                else APIHelper.SKIP
        staff =\
            Staff.from_dictionary(
                dictionary.get("Staff"))\
                if "Staff" in dictionary.keys()\
                else APIHelper.SKIP
        booking_window =\
            BookingWindow.from_dictionary(
                dictionary.get("BookingWindow"))\
                if "BookingWindow" in dictionary.keys()\
                else APIHelper.SKIP
        booking_status =\
            dictionary.get("BookingStatus")\
            if dictionary.get("BookingStatus")\
                else APIHelper.SKIP
        virtual_stream_link =\
            dictionary.get("VirtualStreamLink")\
            if dictionary.get("VirtualStreamLink")\
                else APIHelper.SKIP
        wait_list_size =\
            dictionary.get("WaitListSize")\
            if dictionary.get("WaitListSize")\
                else APIHelper.SKIP
        class_notes =\
            dictionary.get("ClassNotes")\
            if dictionary.get("ClassNotes")\
                else APIHelper.SKIP

        # Return an object of this model
        return cls(class_schedule_id,
                   visits,
                   clients,
                   location,
                   resource,
                   max_capacity,
                   web_capacity,
                   total_booked,
                   total_signed_in,
                   total_booked_waitlist,
                   web_booked,
                   semester_id,
                   is_canceled,
                   substitute,
                   active,
                   is_waitlist_available,
                   is_enrolled,
                   hide_cancel,
                   id,
                   is_available,
                   start_date_time,
                   end_date_time,
                   last_modified_date_time,
                   class_description,
                   staff,
                   booking_window,
                   booking_status,
                   virtual_stream_link,
                   wait_list_size,
                   class_notes)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _class_schedule_id=(
            self.class_schedule_id
            if hasattr(self, "class_schedule_id")
            else None
        )
        _visits=(
            self.visits
            if hasattr(self, "visits")
            else None
        )
        _clients=(
            self.clients
            if hasattr(self, "clients")
            else None
        )
        _location=(
            self.location
            if hasattr(self, "location")
            else None
        )
        _resource=(
            self.resource
            if hasattr(self, "resource")
            else None
        )
        _max_capacity=(
            self.max_capacity
            if hasattr(self, "max_capacity")
            else None
        )
        _web_capacity=(
            self.web_capacity
            if hasattr(self, "web_capacity")
            else None
        )
        _total_booked=(
            self.total_booked
            if hasattr(self, "total_booked")
            else None
        )
        _total_signed_in=(
            self.total_signed_in
            if hasattr(self, "total_signed_in")
            else None
        )
        _total_booked_waitlist=(
            self.total_booked_waitlist
            if hasattr(self, "total_booked_waitlist")
            else None
        )
        _web_booked=(
            self.web_booked
            if hasattr(self, "web_booked")
            else None
        )
        _semester_id=(
            self.semester_id
            if hasattr(self, "semester_id")
            else None
        )
        _is_canceled=(
            self.is_canceled
            if hasattr(self, "is_canceled")
            else None
        )
        _substitute=(
            self.substitute
            if hasattr(self, "substitute")
            else None
        )
        _active=(
            self.active
            if hasattr(self, "active")
            else None
        )
        _is_waitlist_available=(
            self.is_waitlist_available
            if hasattr(self, "is_waitlist_available")
            else None
        )
        _is_enrolled=(
            self.is_enrolled
            if hasattr(self, "is_enrolled")
            else None
        )
        _hide_cancel=(
            self.hide_cancel
            if hasattr(self, "hide_cancel")
            else None
        )
        _id=(
            self.id
            if hasattr(self, "id")
            else None
        )
        _is_available=(
            self.is_available
            if hasattr(self, "is_available")
            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
        )
        _last_modified_date_time=(
            self.last_modified_date_time
            if hasattr(self, "last_modified_date_time")
            else None
        )
        _class_description=(
            self.class_description
            if hasattr(self, "class_description")
            else None
        )
        _staff=(
            self.staff
            if hasattr(self, "staff")
            else None
        )
        _booking_window=(
            self.booking_window
            if hasattr(self, "booking_window")
            else None
        )
        _booking_status=(
            self.booking_status
            if hasattr(self, "booking_status")
            else None
        )
        _virtual_stream_link=(
            self.virtual_stream_link
            if hasattr(self, "virtual_stream_link")
            else None
        )
        _wait_list_size=(
            self.wait_list_size
            if hasattr(self, "wait_list_size")
            else None
        )
        _class_notes=(
            self.class_notes
            if hasattr(self, "class_notes")
            else None
        )
        return (
            f"{self.__class__.__name__}("
            f"class_schedule_id={_class_schedule_id!r}, "
            f"visits={_visits!r}, "
            f"clients={_clients!r}, "
            f"location={_location!r}, "
            f"resource={_resource!r}, "
            f"max_capacity={_max_capacity!r}, "
            f"web_capacity={_web_capacity!r}, "
            f"total_booked={_total_booked!r}, "
            f"total_signed_in={_total_signed_in!r}, "
            f"total_booked_waitlist={_total_booked_waitlist!r}, "
            f"web_booked={_web_booked!r}, "
            f"semester_id={_semester_id!r}, "
            f"is_canceled={_is_canceled!r}, "
            f"substitute={_substitute!r}, "
            f"active={_active!r}, "
            f"is_waitlist_available={_is_waitlist_available!r}, "
            f"is_enrolled={_is_enrolled!r}, "
            f"hide_cancel={_hide_cancel!r}, "
            f"id={_id!r}, "
            f"is_available={_is_available!r}, "
            f"start_date_time={_start_date_time!r}, "
            f"end_date_time={_end_date_time!r}, "
            f"last_modified_date_time={_last_modified_date_time!r}, "
            f"class_description={_class_description!r}, "
            f"staff={_staff!r}, "
            f"booking_window={_booking_window!r}, "
            f"booking_status={_booking_status!r}, "
            f"virtual_stream_link={_virtual_stream_link!r}, "
            f"wait_list_size={_wait_list_size!r}, "
            f"class_notes={_class_notes!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _class_schedule_id=(
            self.class_schedule_id
            if hasattr(self, "class_schedule_id")
            else None
        )
        _visits=(
            self.visits
            if hasattr(self, "visits")
            else None
        )
        _clients=(
            self.clients
            if hasattr(self, "clients")
            else None
        )
        _location=(
            self.location
            if hasattr(self, "location")
            else None
        )
        _resource=(
            self.resource
            if hasattr(self, "resource")
            else None
        )
        _max_capacity=(
            self.max_capacity
            if hasattr(self, "max_capacity")
            else None
        )
        _web_capacity=(
            self.web_capacity
            if hasattr(self, "web_capacity")
            else None
        )
        _total_booked=(
            self.total_booked
            if hasattr(self, "total_booked")
            else None
        )
        _total_signed_in=(
            self.total_signed_in
            if hasattr(self, "total_signed_in")
            else None
        )
        _total_booked_waitlist=(
            self.total_booked_waitlist
            if hasattr(self, "total_booked_waitlist")
            else None
        )
        _web_booked=(
            self.web_booked
            if hasattr(self, "web_booked")
            else None
        )
        _semester_id=(
            self.semester_id
            if hasattr(self, "semester_id")
            else None
        )
        _is_canceled=(
            self.is_canceled
            if hasattr(self, "is_canceled")
            else None
        )
        _substitute=(
            self.substitute
            if hasattr(self, "substitute")
            else None
        )
        _active=(
            self.active
            if hasattr(self, "active")
            else None
        )
        _is_waitlist_available=(
            self.is_waitlist_available
            if hasattr(self, "is_waitlist_available")
            else None
        )
        _is_enrolled=(
            self.is_enrolled
            if hasattr(self, "is_enrolled")
            else None
        )
        _hide_cancel=(
            self.hide_cancel
            if hasattr(self, "hide_cancel")
            else None
        )
        _id=(
            self.id
            if hasattr(self, "id")
            else None
        )
        _is_available=(
            self.is_available
            if hasattr(self, "is_available")
            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
        )
        _last_modified_date_time=(
            self.last_modified_date_time
            if hasattr(self, "last_modified_date_time")
            else None
        )
        _class_description=(
            self.class_description
            if hasattr(self, "class_description")
            else None
        )
        _staff=(
            self.staff
            if hasattr(self, "staff")
            else None
        )
        _booking_window=(
            self.booking_window
            if hasattr(self, "booking_window")
            else None
        )
        _booking_status=(
            self.booking_status
            if hasattr(self, "booking_status")
            else None
        )
        _virtual_stream_link=(
            self.virtual_stream_link
            if hasattr(self, "virtual_stream_link")
            else None
        )
        _wait_list_size=(
            self.wait_list_size
            if hasattr(self, "wait_list_size")
            else None
        )
        _class_notes=(
            self.class_notes
            if hasattr(self, "class_notes")
            else None
        )
        return (
            f"{self.__class__.__name__}("
            f"class_schedule_id={_class_schedule_id!s}, "
            f"visits={_visits!s}, "
            f"clients={_clients!s}, "
            f"location={_location!s}, "
            f"resource={_resource!s}, "
            f"max_capacity={_max_capacity!s}, "
            f"web_capacity={_web_capacity!s}, "
            f"total_booked={_total_booked!s}, "
            f"total_signed_in={_total_signed_in!s}, "
            f"total_booked_waitlist={_total_booked_waitlist!s}, "
            f"web_booked={_web_booked!s}, "
            f"semester_id={_semester_id!s}, "
            f"is_canceled={_is_canceled!s}, "
            f"substitute={_substitute!s}, "
            f"active={_active!s}, "
            f"is_waitlist_available={_is_waitlist_available!s}, "
            f"is_enrolled={_is_enrolled!s}, "
            f"hide_cancel={_hide_cancel!s}, "
            f"id={_id!s}, "
            f"is_available={_is_available!s}, "
            f"start_date_time={_start_date_time!s}, "
            f"end_date_time={_end_date_time!s}, "
            f"last_modified_date_time={_last_modified_date_time!s}, "
            f"class_description={_class_description!s}, "
            f"staff={_staff!s}, "
            f"booking_window={_booking_window!s}, "
            f"booking_status={_booking_status!s}, "
            f"virtual_stream_link={_virtual_stream_link!s}, "
            f"wait_list_size={_wait_list_size!s}, "
            f"class_notes={_class_notes!s}, "
            f")"
        )
