"""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.add_on_small import (
    AddOnSmall,
)
from mindbodypublicapi.models.appointment_staff import (
    AppointmentStaff,
)
from mindbodypublicapi.models.resource_slim import (
    ResourceSlim,
)


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

    Contains information about an appointment.

    Attributes:
        gender_preference (GenderPreferenceEnum): The prefered gender of the
            appointment provider.   Possible values are:  * None  * Female  * Male
        duration (int): The duration of the appointment.
        provider_id (str): If a user has Complementary and Alternative Medicine
            features enabled, this property indicates the provider assigned to the
            appointment.
        id (int): The unique ID of the appointment.
        status (StatusEnum): The status of this appointment.  Possible values are:  *
            None  * Requested  * Booked  * Completed  * Confirmed  * Arrived  *
            NoShow  * Cancelled  * LateCancelled
        start_date_time (datetime): The date and time the appointment is to start.
        end_date_time (datetime): The date and time the appointment is to end.
        notes (str): Any notes associated with the appointment.
        partner_external_id (str): Optional external key for api partners.
        staff_requested (bool): When `true`, indicates that the staff member was
            requested specifically by the client.
        program_id (int): The ID of the program to which this appointment belongs.
        session_type_id (int): The ID of the session type of this appointment.
        location_id (int): The ID of the location where this appointment is to take
            place.
        staff_id (int): The ID of the staff member providing the service for this
            appointment.
        staff (AppointmentStaff): The model property of type AppointmentStaff.
        client_id (str): The RSSID of the client who is booked for this appointment.
        first_appointment (bool): When `true`, indicates that this is the client’s
            first appointment at this site.
        is_waitlist (bool): When `true`, indicates that the client should be added to
            a specific appointment waiting list.  When `false`, the client should not
            be added to the waiting list.  Default: *false*
        waitlist_entry_id (int): The unique ID of the appointment waitlist.
        client_service_id (int): The ID of the pass on the client’s account that is
            to pay for this appointment.
        resources (List[ResourceSlim]): The resources this appointment is to use.
        add_ons (List[AddOnSmall]): Any AddOns associated with the appointment
        online_description (str): Online Description associated with the appointment

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "gender_preference": "GenderPreference",
        "duration": "Duration",
        "provider_id": "ProviderId",
        "id": "Id",
        "status": "Status",
        "start_date_time": "StartDateTime",
        "end_date_time": "EndDateTime",
        "notes": "Notes",
        "partner_external_id": "PartnerExternalId",
        "staff_requested": "StaffRequested",
        "program_id": "ProgramId",
        "session_type_id": "SessionTypeId",
        "location_id": "LocationId",
        "staff_id": "StaffId",
        "staff": "Staff",
        "client_id": "ClientId",
        "first_appointment": "FirstAppointment",
        "is_waitlist": "IsWaitlist",
        "waitlist_entry_id": "WaitlistEntryId",
        "client_service_id": "ClientServiceId",
        "resources": "Resources",
        "add_ons": "AddOns",
        "online_description": "OnlineDescription",
    }

    _optionals = [
        "gender_preference",
        "duration",
        "provider_id",
        "id",
        "status",
        "start_date_time",
        "end_date_time",
        "notes",
        "partner_external_id",
        "staff_requested",
        "program_id",
        "session_type_id",
        "location_id",
        "staff_id",
        "staff",
        "client_id",
        "first_appointment",
        "is_waitlist",
        "waitlist_entry_id",
        "client_service_id",
        "resources",
        "add_ons",
        "online_description",
    ]

    def __init__(
        self,
        gender_preference=APIHelper.SKIP,
        duration=APIHelper.SKIP,
        provider_id=APIHelper.SKIP,
        id=APIHelper.SKIP,
        status=APIHelper.SKIP,
        start_date_time=APIHelper.SKIP,
        end_date_time=APIHelper.SKIP,
        notes=APIHelper.SKIP,
        partner_external_id=APIHelper.SKIP,
        staff_requested=APIHelper.SKIP,
        program_id=APIHelper.SKIP,
        session_type_id=APIHelper.SKIP,
        location_id=APIHelper.SKIP,
        staff_id=APIHelper.SKIP,
        staff=APIHelper.SKIP,
        client_id=APIHelper.SKIP,
        first_appointment=APIHelper.SKIP,
        is_waitlist=APIHelper.SKIP,
        waitlist_entry_id=APIHelper.SKIP,
        client_service_id=APIHelper.SKIP,
        resources=APIHelper.SKIP,
        add_ons=APIHelper.SKIP,
        online_description=APIHelper.SKIP):
        """Initialize a Appointment instance."""
        # Initialize members of the class
        if gender_preference is not APIHelper.SKIP:
            self.gender_preference = gender_preference
        if duration is not APIHelper.SKIP:
            self.duration = duration
        if provider_id is not APIHelper.SKIP:
            self.provider_id = provider_id
        if id is not APIHelper.SKIP:
            self.id = id
        if status is not APIHelper.SKIP:
            self.status = status
        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 notes is not APIHelper.SKIP:
            self.notes = notes
        if partner_external_id is not APIHelper.SKIP:
            self.partner_external_id = partner_external_id
        if staff_requested is not APIHelper.SKIP:
            self.staff_requested = staff_requested
        if program_id is not APIHelper.SKIP:
            self.program_id = program_id
        if session_type_id is not APIHelper.SKIP:
            self.session_type_id = session_type_id
        if location_id is not APIHelper.SKIP:
            self.location_id = location_id
        if staff_id is not APIHelper.SKIP:
            self.staff_id = staff_id
        if staff is not APIHelper.SKIP:
            self.staff = staff
        if client_id is not APIHelper.SKIP:
            self.client_id = client_id
        if first_appointment is not APIHelper.SKIP:
            self.first_appointment = first_appointment
        if is_waitlist is not APIHelper.SKIP:
            self.is_waitlist = is_waitlist
        if waitlist_entry_id is not APIHelper.SKIP:
            self.waitlist_entry_id = waitlist_entry_id
        if client_service_id is not APIHelper.SKIP:
            self.client_service_id = client_service_id
        if resources is not APIHelper.SKIP:
            self.resources = resources
        if add_ons is not APIHelper.SKIP:
            self.add_ons = add_ons
        if online_description is not APIHelper.SKIP:
            self.online_description = online_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
        gender_preference =\
            dictionary.get("GenderPreference")\
            if dictionary.get("GenderPreference")\
                else APIHelper.SKIP
        duration =\
            dictionary.get("Duration")\
            if dictionary.get("Duration")\
                else APIHelper.SKIP
        provider_id =\
            dictionary.get("ProviderId")\
            if dictionary.get("ProviderId")\
                else APIHelper.SKIP
        id =\
            dictionary.get("Id")\
            if dictionary.get("Id")\
                else APIHelper.SKIP
        status =\
            dictionary.get("Status")\
            if dictionary.get("Status")\
                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
        notes =\
            dictionary.get("Notes")\
            if dictionary.get("Notes")\
                else APIHelper.SKIP
        partner_external_id =\
            dictionary.get("PartnerExternalId")\
            if dictionary.get("PartnerExternalId")\
                else APIHelper.SKIP
        staff_requested =\
            dictionary.get("StaffRequested")\
            if "StaffRequested" in dictionary.keys()\
                else APIHelper.SKIP
        program_id =\
            dictionary.get("ProgramId")\
            if dictionary.get("ProgramId")\
                else APIHelper.SKIP
        session_type_id =\
            dictionary.get("SessionTypeId")\
            if dictionary.get("SessionTypeId")\
                else APIHelper.SKIP
        location_id =\
            dictionary.get("LocationId")\
            if dictionary.get("LocationId")\
                else APIHelper.SKIP
        staff_id =\
            dictionary.get("StaffId")\
            if dictionary.get("StaffId")\
                else APIHelper.SKIP
        staff =\
            AppointmentStaff.from_dictionary(
                dictionary.get("Staff"))\
                if "Staff" in dictionary.keys()\
                else APIHelper.SKIP
        client_id =\
            dictionary.get("ClientId")\
            if dictionary.get("ClientId")\
                else APIHelper.SKIP
        first_appointment =\
            dictionary.get("FirstAppointment")\
            if "FirstAppointment" in dictionary.keys()\
                else APIHelper.SKIP
        is_waitlist =\
            dictionary.get("IsWaitlist")\
            if "IsWaitlist" in dictionary.keys()\
                else APIHelper.SKIP
        waitlist_entry_id =\
            dictionary.get("WaitlistEntryId")\
            if dictionary.get("WaitlistEntryId")\
                else APIHelper.SKIP
        client_service_id =\
            dictionary.get("ClientServiceId")\
            if dictionary.get("ClientServiceId")\
                else APIHelper.SKIP
        resources = None
        if dictionary.get("Resources") is not None:
            resources = [
                ResourceSlim.from_dictionary(x)
                    for x in dictionary.get("Resources")
            ]
        else:
            resources = APIHelper.SKIP
        add_ons = None
        if dictionary.get("AddOns") is not None:
            add_ons = [
                AddOnSmall.from_dictionary(x)
                    for x in dictionary.get("AddOns")
            ]
        else:
            add_ons = APIHelper.SKIP
        online_description =\
            dictionary.get("OnlineDescription")\
            if dictionary.get("OnlineDescription")\
                else APIHelper.SKIP

        # Return an object of this model
        return cls(gender_preference,
                   duration,
                   provider_id,
                   id,
                   status,
                   start_date_time,
                   end_date_time,
                   notes,
                   partner_external_id,
                   staff_requested,
                   program_id,
                   session_type_id,
                   location_id,
                   staff_id,
                   staff,
                   client_id,
                   first_appointment,
                   is_waitlist,
                   waitlist_entry_id,
                   client_service_id,
                   resources,
                   add_ons,
                   online_description)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _gender_preference=(
            self.gender_preference
            if hasattr(self, "gender_preference")
            else None
        )
        _duration=(
            self.duration
            if hasattr(self, "duration")
            else None
        )
        _provider_id=(
            self.provider_id
            if hasattr(self, "provider_id")
            else None
        )
        _id=(
            self.id
            if hasattr(self, "id")
            else None
        )
        _status=(
            self.status
            if hasattr(self, "status")
            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
        )
        _notes=(
            self.notes
            if hasattr(self, "notes")
            else None
        )
        _partner_external_id=(
            self.partner_external_id
            if hasattr(self, "partner_external_id")
            else None
        )
        _staff_requested=(
            self.staff_requested
            if hasattr(self, "staff_requested")
            else None
        )
        _program_id=(
            self.program_id
            if hasattr(self, "program_id")
            else None
        )
        _session_type_id=(
            self.session_type_id
            if hasattr(self, "session_type_id")
            else None
        )
        _location_id=(
            self.location_id
            if hasattr(self, "location_id")
            else None
        )
        _staff_id=(
            self.staff_id
            if hasattr(self, "staff_id")
            else None
        )
        _staff=(
            self.staff
            if hasattr(self, "staff")
            else None
        )
        _client_id=(
            self.client_id
            if hasattr(self, "client_id")
            else None
        )
        _first_appointment=(
            self.first_appointment
            if hasattr(self, "first_appointment")
            else None
        )
        _is_waitlist=(
            self.is_waitlist
            if hasattr(self, "is_waitlist")
            else None
        )
        _waitlist_entry_id=(
            self.waitlist_entry_id
            if hasattr(self, "waitlist_entry_id")
            else None
        )
        _client_service_id=(
            self.client_service_id
            if hasattr(self, "client_service_id")
            else None
        )
        _resources=(
            self.resources
            if hasattr(self, "resources")
            else None
        )
        _add_ons=(
            self.add_ons
            if hasattr(self, "add_ons")
            else None
        )
        _online_description=(
            self.online_description
            if hasattr(self, "online_description")
            else None
        )
        return (
            f"{self.__class__.__name__}("
            f"gender_preference={_gender_preference!r}, "
            f"duration={_duration!r}, "
            f"provider_id={_provider_id!r}, "
            f"id={_id!r}, "
            f"status={_status!r}, "
            f"start_date_time={_start_date_time!r}, "
            f"end_date_time={_end_date_time!r}, "
            f"notes={_notes!r}, "
            f"partner_external_id={_partner_external_id!r}, "
            f"staff_requested={_staff_requested!r}, "
            f"program_id={_program_id!r}, "
            f"session_type_id={_session_type_id!r}, "
            f"location_id={_location_id!r}, "
            f"staff_id={_staff_id!r}, "
            f"staff={_staff!r}, "
            f"client_id={_client_id!r}, "
            f"first_appointment={_first_appointment!r}, "
            f"is_waitlist={_is_waitlist!r}, "
            f"waitlist_entry_id={_waitlist_entry_id!r}, "
            f"client_service_id={_client_service_id!r}, "
            f"resources={_resources!r}, "
            f"add_ons={_add_ons!r}, "
            f"online_description={_online_description!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _gender_preference=(
            self.gender_preference
            if hasattr(self, "gender_preference")
            else None
        )
        _duration=(
            self.duration
            if hasattr(self, "duration")
            else None
        )
        _provider_id=(
            self.provider_id
            if hasattr(self, "provider_id")
            else None
        )
        _id=(
            self.id
            if hasattr(self, "id")
            else None
        )
        _status=(
            self.status
            if hasattr(self, "status")
            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
        )
        _notes=(
            self.notes
            if hasattr(self, "notes")
            else None
        )
        _partner_external_id=(
            self.partner_external_id
            if hasattr(self, "partner_external_id")
            else None
        )
        _staff_requested=(
            self.staff_requested
            if hasattr(self, "staff_requested")
            else None
        )
        _program_id=(
            self.program_id
            if hasattr(self, "program_id")
            else None
        )
        _session_type_id=(
            self.session_type_id
            if hasattr(self, "session_type_id")
            else None
        )
        _location_id=(
            self.location_id
            if hasattr(self, "location_id")
            else None
        )
        _staff_id=(
            self.staff_id
            if hasattr(self, "staff_id")
            else None
        )
        _staff=(
            self.staff
            if hasattr(self, "staff")
            else None
        )
        _client_id=(
            self.client_id
            if hasattr(self, "client_id")
            else None
        )
        _first_appointment=(
            self.first_appointment
            if hasattr(self, "first_appointment")
            else None
        )
        _is_waitlist=(
            self.is_waitlist
            if hasattr(self, "is_waitlist")
            else None
        )
        _waitlist_entry_id=(
            self.waitlist_entry_id
            if hasattr(self, "waitlist_entry_id")
            else None
        )
        _client_service_id=(
            self.client_service_id
            if hasattr(self, "client_service_id")
            else None
        )
        _resources=(
            self.resources
            if hasattr(self, "resources")
            else None
        )
        _add_ons=(
            self.add_ons
            if hasattr(self, "add_ons")
            else None
        )
        _online_description=(
            self.online_description
            if hasattr(self, "online_description")
            else None
        )
        return (
            f"{self.__class__.__name__}("
            f"gender_preference={_gender_preference!s}, "
            f"duration={_duration!s}, "
            f"provider_id={_provider_id!s}, "
            f"id={_id!s}, "
            f"status={_status!s}, "
            f"start_date_time={_start_date_time!s}, "
            f"end_date_time={_end_date_time!s}, "
            f"notes={_notes!s}, "
            f"partner_external_id={_partner_external_id!s}, "
            f"staff_requested={_staff_requested!s}, "
            f"program_id={_program_id!s}, "
            f"session_type_id={_session_type_id!s}, "
            f"location_id={_location_id!s}, "
            f"staff_id={_staff_id!s}, "
            f"staff={_staff!s}, "
            f"client_id={_client_id!s}, "
            f"first_appointment={_first_appointment!s}, "
            f"is_waitlist={_is_waitlist!s}, "
            f"waitlist_entry_id={_waitlist_entry_id!s}, "
            f"client_service_id={_client_service_id!s}, "
            f"resources={_resources!s}, "
            f"add_ons={_add_ons!s}, "
            f"online_description={_online_description!s}, "
            f")"
        )
