"""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_schedule import (
    ClassSchedule,
)
from mindbodypublicapi.models.client import (
    Client,
)


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

    Attributes:
        class_date (datetime): The date of the class or enrollment.
        class_id (int): The ID of the class or enrollment.
        class_schedule (ClassSchedule): Represents a single class instance. The class
            meets at the start time, goes until the end time.
        client (Client): The Client.
        enrollment_date_forward (datetime): If the waiting list entry was created for
            an enrollment, this is the date on or after which the client can be added
            to the enrollment from the waitlist.
        id (int): The ID of the waiting list entry.
        request_date_time (datetime): The date and time that the request to be on the
            waiting list was made.
        visit_ref_no (int): The ID of the visit that is associated with the waiting
            list entry.
        web (bool): If `true`, the entry on the waiting list was requested online.<br
            />  If `false`, the entry on the waiting list was requested off-line, for
            example in person or by phone.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "class_date": "ClassDate",
        "class_id": "ClassId",
        "class_schedule": "ClassSchedule",
        "client": "Client",
        "enrollment_date_forward": "EnrollmentDateForward",
        "id": "Id",
        "request_date_time": "RequestDateTime",
        "visit_ref_no": "VisitRefNo",
        "web": "Web",
    }

    _optionals = [
        "class_date",
        "class_id",
        "class_schedule",
        "client",
        "enrollment_date_forward",
        "id",
        "request_date_time",
        "visit_ref_no",
        "web",
    ]

    def __init__(
        self,
        class_date=APIHelper.SKIP,
        class_id=APIHelper.SKIP,
        class_schedule=APIHelper.SKIP,
        client=APIHelper.SKIP,
        enrollment_date_forward=APIHelper.SKIP,
        id=APIHelper.SKIP,
        request_date_time=APIHelper.SKIP,
        visit_ref_no=APIHelper.SKIP,
        web=APIHelper.SKIP):
        """Initialize a WaitlistEntry instance."""
        # Initialize members of the class
        if class_date is not APIHelper.SKIP:
            self.class_date =\
                 APIHelper.apply_datetime_converter(
                class_date, APIHelper.RFC3339DateTime)\
                 if class_date else None
        if class_id is not APIHelper.SKIP:
            self.class_id = class_id
        if class_schedule is not APIHelper.SKIP:
            self.class_schedule = class_schedule
        if client is not APIHelper.SKIP:
            self.client = client
        if enrollment_date_forward is not APIHelper.SKIP:
            self.enrollment_date_forward =\
                 APIHelper.apply_datetime_converter(
                enrollment_date_forward, APIHelper.RFC3339DateTime)\
                 if enrollment_date_forward else None
        if id is not APIHelper.SKIP:
            self.id = id
        if request_date_time is not APIHelper.SKIP:
            self.request_date_time =\
                 APIHelper.apply_datetime_converter(
                request_date_time, APIHelper.RFC3339DateTime)\
                 if request_date_time else None
        if visit_ref_no is not APIHelper.SKIP:
            self.visit_ref_no = visit_ref_no
        if web is not APIHelper.SKIP:
            self.web = web

    @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_date = APIHelper.RFC3339DateTime.from_value(
            dictionary.get("ClassDate")).datetime\
            if dictionary.get("ClassDate") else APIHelper.SKIP
        class_id =\
            dictionary.get("ClassId")\
            if dictionary.get("ClassId")\
                else APIHelper.SKIP
        class_schedule =\
            ClassSchedule.from_dictionary(
                dictionary.get("ClassSchedule"))\
                if "ClassSchedule" in dictionary.keys()\
                else APIHelper.SKIP
        client =\
            Client.from_dictionary(
                dictionary.get("Client"))\
                if "Client" in dictionary.keys()\
                else APIHelper.SKIP
        enrollment_date_forward = APIHelper.RFC3339DateTime.from_value(
            dictionary.get("EnrollmentDateForward")).datetime\
            if dictionary.get("EnrollmentDateForward") else APIHelper.SKIP
        id =\
            dictionary.get("Id")\
            if dictionary.get("Id")\
                else APIHelper.SKIP
        request_date_time = APIHelper.RFC3339DateTime.from_value(
            dictionary.get("RequestDateTime")).datetime\
            if dictionary.get("RequestDateTime") else APIHelper.SKIP
        visit_ref_no =\
            dictionary.get("VisitRefNo")\
            if dictionary.get("VisitRefNo")\
                else APIHelper.SKIP
        web =\
            dictionary.get("Web")\
            if "Web" in dictionary.keys()\
                else APIHelper.SKIP

        # Return an object of this model
        return cls(class_date,
                   class_id,
                   class_schedule,
                   client,
                   enrollment_date_forward,
                   id,
                   request_date_time,
                   visit_ref_no,
                   web)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _class_date=(
            self.class_date
            if hasattr(self, "class_date")
            else None
        )
        _class_id=(
            self.class_id
            if hasattr(self, "class_id")
            else None
        )
        _class_schedule=(
            self.class_schedule
            if hasattr(self, "class_schedule")
            else None
        )
        _client=(
            self.client
            if hasattr(self, "client")
            else None
        )
        _enrollment_date_forward=(
            self.enrollment_date_forward
            if hasattr(self, "enrollment_date_forward")
            else None
        )
        _id=(
            self.id
            if hasattr(self, "id")
            else None
        )
        _request_date_time=(
            self.request_date_time
            if hasattr(self, "request_date_time")
            else None
        )
        _visit_ref_no=(
            self.visit_ref_no
            if hasattr(self, "visit_ref_no")
            else None
        )
        _web=(
            self.web
            if hasattr(self, "web")
            else None
        )
        return (
            f"{self.__class__.__name__}("
            f"class_date={_class_date!r}, "
            f"class_id={_class_id!r}, "
            f"class_schedule={_class_schedule!r}, "
            f"client={_client!r}, "
            f"enrollment_date_forward={_enrollment_date_forward!r}, "
            f"id={_id!r}, "
            f"request_date_time={_request_date_time!r}, "
            f"visit_ref_no={_visit_ref_no!r}, "
            f"web={_web!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _class_date=(
            self.class_date
            if hasattr(self, "class_date")
            else None
        )
        _class_id=(
            self.class_id
            if hasattr(self, "class_id")
            else None
        )
        _class_schedule=(
            self.class_schedule
            if hasattr(self, "class_schedule")
            else None
        )
        _client=(
            self.client
            if hasattr(self, "client")
            else None
        )
        _enrollment_date_forward=(
            self.enrollment_date_forward
            if hasattr(self, "enrollment_date_forward")
            else None
        )
        _id=(
            self.id
            if hasattr(self, "id")
            else None
        )
        _request_date_time=(
            self.request_date_time
            if hasattr(self, "request_date_time")
            else None
        )
        _visit_ref_no=(
            self.visit_ref_no
            if hasattr(self, "visit_ref_no")
            else None
        )
        _web=(
            self.web
            if hasattr(self, "web")
            else None
        )
        return (
            f"{self.__class__.__name__}("
            f"class_date={_class_date!s}, "
            f"class_id={_class_id!s}, "
            f"class_schedule={_class_schedule!s}, "
            f"client={_client!s}, "
            f"enrollment_date_forward={_enrollment_date_forward!s}, "
            f"id={_id!s}, "
            f"request_date_time={_request_date_time!s}, "
            f"visit_ref_no={_visit_ref_no!s}, "
            f"web={_web!s}, "
            f")"
        )
