"""mindbodypublicapi.

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

# ruff: noqa: D410, E501, E101, D206
from apimatic_core.authentication.multiple.single_auth import (
    Single,
)
from apimatic_core.request_builder import RequestBuilder
from apimatic_core.response_handler import ResponseHandler
from apimatic_core.types.parameter import Parameter

from mindbodypublicapi.api_helper import APIHelper
from mindbodypublicapi.configuration import (
    Server,
)
from mindbodypublicapi.controllers.base_controller import (
    BaseController,
)
from mindbodypublicapi.http.http_method_enum import (
    HttpMethodEnum,
)
from mindbodypublicapi.models.add_appointment_add_on_response import (
    AddAppointmentAddOnResponse,
)
from mindbodypublicapi.models.add_appointment_response import (
    AddAppointmentResponse,
)
from mindbodypublicapi.models.add_availabilities_response import (
    AddAvailabilitiesResponse,
)
from mindbodypublicapi.models.add_multiple_appointments_response import (
    AddMultipleAppointmentsResponse,
)
from mindbodypublicapi.models.get_active_session_times_response import (
    GetActiveSessionTimesResponse,
)
from mindbodypublicapi.models.get_add_ons_response import (
    GetAddOnsResponse,
)
from mindbodypublicapi.models.get_appointment_options_response import (
    GetAppointmentOptionsResponse,
)
from mindbodypublicapi.models.get_available_dates_response import (
    GetAvailableDatesResponse,
)
from mindbodypublicapi.models.get_bookable_items_response import (
    GetBookableItemsResponse,
)
from mindbodypublicapi.models.get_schedule_items_response import (
    GetScheduleItemsResponse,
)
from mindbodypublicapi.models.get_staff_appointments_response import (
    GetStaffAppointmentsResponse,
)
from mindbodypublicapi.models.get_unavailabilities_response import (
    GetUnavailabilitiesResponse,
)
from mindbodypublicapi.models.update_appointment_response import (
    UpdateAppointmentResponse,
)
from mindbodypublicapi.models.update_availability_response import (
    UpdateAvailabilityResponse,
)


class AppointmentController(BaseController):
    """A Controller to access Endpoints in the mindbodypublicapi API."""

    def __init__(self, config):
        """Initialize AppointmentController object."""
        super(AppointmentController, self).__init__(config)

    def get_active_session_times(self,
                                 version,
                                 site_id,
                                 authorization=None,
                                 request_end_time=None,
                                 request_limit=None,
                                 request_offset=None,
                                 request_schedule_type=None,
                                 request_session_type_ids=None,
                                 request_start_time=None):
        """Perform a GET request to
        /public/v{version}/appointment/activesessiontimes.

        This is not appointment availability but rather the active business hours for
        studios and which increments services can be booked at. See BookableItems for
        appointment availability.

        Args:
            version (str): version of the api.
            site_id (str): ID of the site from which to pull data.
            authorization (str, optional): A staff user authorization token.
            request_end_time (datetime, optional): Filters results to times that end
                on or before this time on the current date. Any date provided is
                ignored..  <br />Default: **23:59:59**
            request_limit (int, optional): Number of results to include, defaults to
                100
            request_offset (int, optional): Page offset, defaults to 0.
            request_schedule_type (RequestScheduleTypeEnum, optional): Filters on the
                provided the schedule type. Either `SessionTypeIds` or `ScheduleType`
                must be provided.
            request_session_type_ids (List[int], optional): Filters on the provided
                session type IDs. Either `SessionTypeIds` or `ScheduleType` must be
                provided.
            request_start_time (datetime, optional): Filters results to times that
                start on or after this time on the current date. Any date provided is
                ignored.  <br />Default: **00:00:00**

        Returns:
            GetActiveSessionTimesResponse: Response from the API. OK

        Raises:
            APIException: When an error occurs while fetching the data from the
                remote API. This exception includes the HTTP Response code, an error
                message, and the HTTP body that was received in the request.

        """
        return super().new_api_call_builder.request(
            RequestBuilder().server(Server.DEFAULT)
            .path("/public/v{version}/appointment/activesessiontimes")
            .http_method(HttpMethodEnum.GET)
            .template_param(Parameter()
                .key("version")
                .value(version)
                .should_encode(True))
            .header_param(Parameter()
                .key("siteId")
                .value(site_id))
            .header_param(Parameter()
                .key("authorization")
                .value(authorization))
            .query_param(Parameter()
                .key("request.endTime")
                .value(APIHelper.when_defined(APIHelper.RFC3339DateTime,
                    request_end_time)))
            .query_param(Parameter()
                .key("request.limit")
                .value(request_limit))
            .query_param(Parameter()
                .key("request.offset")
                .value(request_offset))
            .query_param(Parameter()
                .key("request.scheduleType")
                .value(request_schedule_type))
            .query_param(Parameter()
                .key("request.sessionTypeIds")
                .value(request_session_type_ids))
            .query_param(Parameter()
                .key("request.startTime")
                .value(APIHelper.when_defined(APIHelper.RFC3339DateTime,
                    request_start_time)))
            .header_param(Parameter()
                .key("accept")
                .value("application/json"))
            .auth(Single("API-Key")),
        ).response(
            ResponseHandler()
            .deserializer(APIHelper.json_deserialize)
            .deserialize_into(GetActiveSessionTimesResponse.from_dictionary),
        ).execute()

    def get_add_ons(self,
                    version,
                    site_id,
                    authorization=None,
                    request_limit=None,
                    request_offset=None,
                    request_staff_id=None):
        """Perform a GET request to /public/v{version}/appointment/addons.

        Get active appointment add-ons.

        Args:
            version (str): version of the api.
            site_id (str): ID of the site from which to pull data.
            authorization (str, optional): A staff user authorization token.
            request_limit (int, optional): Number of results to include, defaults to
                100
            request_offset (int, optional): Page offset, defaults to 0.
            request_staff_id (int, optional): Filter to add-ons only performed by
                this staff member.

        Returns:
            GetAddOnsResponse: Response from the API. OK

        Raises:
            APIException: When an error occurs while fetching the data from the
                remote API. This exception includes the HTTP Response code, an error
                message, and the HTTP body that was received in the request.

        """
        return super().new_api_call_builder.request(
            RequestBuilder().server(Server.DEFAULT)
            .path("/public/v{version}/appointment/addons")
            .http_method(HttpMethodEnum.GET)
            .template_param(Parameter()
                .key("version")
                .value(version)
                .should_encode(True))
            .header_param(Parameter()
                .key("siteId")
                .value(site_id))
            .header_param(Parameter()
                .key("authorization")
                .value(authorization))
            .query_param(Parameter()
                .key("request.limit")
                .value(request_limit))
            .query_param(Parameter()
                .key("request.offset")
                .value(request_offset))
            .query_param(Parameter()
                .key("request.staffId")
                .value(request_staff_id))
            .header_param(Parameter()
                .key("accept")
                .value("application/json"))
            .auth(Single("API-Key")),
        ).response(
            ResponseHandler()
            .deserializer(APIHelper.json_deserialize)
            .deserialize_into(GetAddOnsResponse.from_dictionary),
        ).execute()

    def get_appointment_options(self,
                                version,
                                site_id,
                                authorization=None):
        """Perform a GET request to
        /public/v{version}/appointment/appointmentoptions.

        This endpoint has no query parameters.

        Args:
            version (str): version of the api.
            site_id (str): ID of the site from which to pull data.
            authorization (str, optional): A staff user authorization token.

        Returns:
            GetAppointmentOptionsResponse: Response from the API. OK

        Raises:
            APIException: When an error occurs while fetching the data from the
                remote API. This exception includes the HTTP Response code, an error
                message, and the HTTP body that was received in the request.

        """
        return super().new_api_call_builder.request(
            RequestBuilder().server(Server.DEFAULT)
            .path("/public/v{version}/appointment/appointmentoptions")
            .http_method(HttpMethodEnum.GET)
            .template_param(Parameter()
                .key("version")
                .value(version)
                .should_encode(True))
            .header_param(Parameter()
                .key("siteId")
                .value(site_id))
            .header_param(Parameter()
                .key("authorization")
                .value(authorization))
            .header_param(Parameter()
                .key("accept")
                .value("application/json"))
            .auth(Single("API-Key")),
        ).response(
            ResponseHandler()
            .deserializer(APIHelper.json_deserialize)
            .deserialize_into(GetAppointmentOptionsResponse.from_dictionary),
        ).execute()

    def get_available_dates(self,
                            version,
                            request_session_type_id,
                            site_id,
                            authorization=None,
                            request_end_date=None,
                            request_location_id=None,
                            request_staff_id=None,
                            request_start_date=None):
        """Perform a GET request to
        /public/v{version}/appointment/availabledates.

        Returns a list of dates to narrow down staff availability when booking. Dates
        are those which staff are scheduled to work and do not guarantee booking
        availabilities. After this call is made, use GET BookableItems to retrieve
        availabilities for specific dates before booking.

        Args:
            version (str): version of the api.
            request_session_type_id (int): required requested session type ID.
            site_id (str): ID of the site from which to pull data.
            authorization (str, optional): A staff user authorization token.
            request_end_date (datetime, optional): The end date of the requested date
                range.   <br />Default: **StartDate**
            request_location_id (int, optional): optional requested location ID.
            request_staff_id (int, optional): optional requested staff ID.
            request_start_date (datetime, optional): The start date of the requested
                date range. If omitted, the default is used.  <br />Default:
                **today’s date**

        Returns:
            GetAvailableDatesResponse: Response from the API. OK

        Raises:
            APIException: When an error occurs while fetching the data from the
                remote API. This exception includes the HTTP Response code, an error
                message, and the HTTP body that was received in the request.

        """
        return super().new_api_call_builder.request(
            RequestBuilder().server(Server.DEFAULT)
            .path("/public/v{version}/appointment/availabledates")
            .http_method(HttpMethodEnum.GET)
            .template_param(Parameter()
                .key("version")
                .value(version)
                .should_encode(True))
            .query_param(Parameter()
                .key("request.sessionTypeId")
                .value(request_session_type_id))
            .header_param(Parameter()
                .key("siteId")
                .value(site_id))
            .header_param(Parameter()
                .key("authorization")
                .value(authorization))
            .query_param(Parameter()
                .key("request.endDate")
                .value(APIHelper.when_defined(APIHelper.RFC3339DateTime,
                    request_end_date)))
            .query_param(Parameter()
                .key("request.locationId")
                .value(request_location_id))
            .query_param(Parameter()
                .key("request.staffId")
                .value(request_staff_id))
            .query_param(Parameter()
                .key("request.startDate")
                .value(APIHelper.when_defined(APIHelper.RFC3339DateTime,
                    request_start_date)))
            .header_param(Parameter()
                .key("accept")
                .value("application/json"))
            .auth(Single("API-Key")),
        ).response(
            ResponseHandler()
            .deserializer(APIHelper.json_deserialize)
            .deserialize_into(GetAvailableDatesResponse.from_dictionary),
        ).execute()

    def get_bookable_items(self,
                           version,
                           request_session_type_ids,
                           site_id,
                           authorization=None,
                           request_appointment_id=None,
                           request_end_date=None,
                           request_ignore_default_session_length=None,
                           request_include_resource_availability=None,
                           request_limit=None,
                           request_location_ids=None,
                           request_offset=None,
                           request_staff_ids=None,
                           request_start_date=None):
        """Perform a GET request to
        /public/v{version}/appointment/bookableitems.

        Returns a list of availabilities with the information needed to book
        appointments. Availabilities include information such as the location and its
        amenities, staff members, programs, and session types. Recommended to use
        with GET AvailableDates to see what dates the staff is scheduled to work and
        narrow down the dates searched. Recommended to use with GET
        ActiveSessionTimes to see which increments each business allows for booking
        appointments.
        Notes:
        - With a wider range of dates, this call may take longer to return results.
        - With a higher number of request.sessionTypeIds, this call may take longer
        to return results.

        Args:
            version (str): version of the api.
            request_session_type_ids (List[int]): A list of the requested session
                type IDs.
            site_id (str): ID of the site from which to pull data.
            authorization (str, optional): A staff user authorization token.
            request_appointment_id (int, optional): If provided, filters out the
                appointment with this ID.
            request_end_date (datetime, optional): The end date of the requested date
                range.   <br />Default: **StartDate**
            request_ignore_default_session_length (bool, optional): When `true`,
                availabilities that are non-default return, for example, a 30-minute
                availability with a 60-minute default session length.<br />  When
                `false`, only availabilities that have the default session length
                return.
            request_include_resource_availability (bool, optional): When `true`,
                resource availabilities for the session type are returned.<br />
                When `false`, resource availabilities are not returned default.
            request_limit (int, optional): Number of results to include, defaults to
                100
            request_location_ids (List[int], optional): A list of the requested
                location IDs.
            request_offset (int, optional): Page offset, defaults to 0.
            request_staff_ids (List[int], optional): A list of the requested staff
                IDs. Omit parameter to return all staff availabilities.
            request_start_date (datetime, optional): The start date of the requested
                date range.   <br />Default: **today’s date**

        Returns:
            GetBookableItemsResponse: Response from the API. OK

        Raises:
            APIException: When an error occurs while fetching the data from the
                remote API. This exception includes the HTTP Response code, an error
                message, and the HTTP body that was received in the request.

        """
        return super().new_api_call_builder.request(
            RequestBuilder().server(Server.DEFAULT)
            .path("/public/v{version}/appointment/bookableitems")
            .http_method(HttpMethodEnum.GET)
            .template_param(Parameter()
                .key("version")
                .value(version)
                .should_encode(True))
            .query_param(Parameter()
                .key("request.sessionTypeIds")
                .value(request_session_type_ids))
            .header_param(Parameter()
                .key("siteId")
                .value(site_id))
            .header_param(Parameter()
                .key("authorization")
                .value(authorization))
            .query_param(Parameter()
                .key("request.appointmentId")
                .value(request_appointment_id))
            .query_param(Parameter()
                .key("request.endDate")
                .value(APIHelper.when_defined(APIHelper.RFC3339DateTime,
                    request_end_date)))
            .query_param(Parameter()
                .key("request.ignoreDefaultSessionLength")
                .value(request_ignore_default_session_length))
            .query_param(Parameter()
                .key("request.includeResourceAvailability")
                .value(request_include_resource_availability))
            .query_param(Parameter()
                .key("request.limit")
                .value(request_limit))
            .query_param(Parameter()
                .key("request.locationIds")
                .value(request_location_ids))
            .query_param(Parameter()
                .key("request.offset")
                .value(request_offset))
            .query_param(Parameter()
                .key("request.staffIds")
                .value(request_staff_ids))
            .query_param(Parameter()
                .key("request.startDate")
                .value(APIHelper.when_defined(APIHelper.RFC3339DateTime,
                    request_start_date)))
            .header_param(Parameter()
                .key("accept")
                .value("application/json"))
            .auth(Single("API-Key")),
        ).response(
            ResponseHandler()
            .deserializer(APIHelper.json_deserialize)
            .deserialize_into(GetBookableItemsResponse.from_dictionary),
        ).execute()

    def get_schedule_items(self,
                           version,
                           site_id,
                           authorization=None,
                           request_end_date=None,
                           request_ignore_prep_finish_times=None,
                           request_limit=None,
                           request_location_ids=None,
                           request_offset=None,
                           request_staff_ids=None,
                           request_start_date=None):
        """Perform a GET request to
        /public/v{version}/appointment/scheduleitems.

        Returns a list of schedule items, including appointments, availabilities, and
        unavailabilities. Unavailabilities are the times at which appointments cannot
        be booked, for example, on holidays or after hours when the business is
        closed.

        Args:
            version (str): version of the api.
            site_id (str): ID of the site from which to pull data.
            authorization (str, optional): A staff user authorization token.
            request_end_date (datetime, optional): The end date of the requested date
                range.   <br />Default: **today’s date**
            request_ignore_prep_finish_times (bool, optional): When `true`,
                appointment preparation and finish unavailabilities are not returned.
                <br />Default: **false**
            request_limit (int, optional): Number of results to include, defaults to
                100
            request_location_ids (List[int], optional): A list of requested location
                IDs.
            request_offset (int, optional): Page offset, defaults to 0.
            request_staff_ids (List[int], optional): A list of requested staff IDs.
            request_start_date (datetime, optional): The start date of the requested
                date range.   <br />Default: **today’s date**

        Returns:
            GetScheduleItemsResponse: Response from the API. OK

        Raises:
            APIException: When an error occurs while fetching the data from the
                remote API. This exception includes the HTTP Response code, an error
                message, and the HTTP body that was received in the request.

        """
        return super().new_api_call_builder.request(
            RequestBuilder().server(Server.DEFAULT)
            .path("/public/v{version}/appointment/scheduleitems")
            .http_method(HttpMethodEnum.GET)
            .template_param(Parameter()
                .key("version")
                .value(version)
                .should_encode(True))
            .header_param(Parameter()
                .key("siteId")
                .value(site_id))
            .header_param(Parameter()
                .key("authorization")
                .value(authorization))
            .query_param(Parameter()
                .key("request.endDate")
                .value(APIHelper.when_defined(APIHelper.RFC3339DateTime,
                    request_end_date)))
            .query_param(Parameter()
                .key("request.ignorePrepFinishTimes")
                .value(request_ignore_prep_finish_times))
            .query_param(Parameter()
                .key("request.limit")
                .value(request_limit))
            .query_param(Parameter()
                .key("request.locationIds")
                .value(request_location_ids))
            .query_param(Parameter()
                .key("request.offset")
                .value(request_offset))
            .query_param(Parameter()
                .key("request.staffIds")
                .value(request_staff_ids))
            .query_param(Parameter()
                .key("request.startDate")
                .value(APIHelper.when_defined(APIHelper.RFC3339DateTime,
                    request_start_date)))
            .header_param(Parameter()
                .key("accept")
                .value("application/json"))
            .auth(Single("API-Key")),
        ).response(
            ResponseHandler()
            .deserializer(APIHelper.json_deserialize)
            .deserialize_into(GetScheduleItemsResponse.from_dictionary),
        ).execute()

    def get_staff_appointments(self,
                               version,
                               site_id,
                               authorization=None,
                               request_appointment_ids=None,
                               request_client_id=None,
                               request_end_date=None,
                               request_limit=None,
                               request_location_ids=None,
                               request_offset=None,
                               request_staff_ids=None,
                               request_start_date=None,
                               request_use_site_settings_staff_name=None):
        """Perform a GET request to
        /public/v{version}/appointment/staffappointments.

        Returns a list of appointments by staff member.

        Args:
            version (str): version of the api.
            site_id (str): ID of the site from which to pull data.
            authorization (str, optional): A staff user authorization token.
            request_appointment_ids (List[int], optional): A list of the requested
                appointment IDs.
            request_client_id (str, optional): The client ID to be returned.
            request_end_date (datetime, optional): The end date of the requested date
                range.   <br />Default: **StartDate**
            request_limit (int, optional): Number of results to include, defaults to
                100
            request_location_ids (List[int], optional): A list of the requested
                location IDs.
            request_offset (int, optional): Page offset, defaults to 0.
            request_staff_ids (List[int], optional): List of staff IDs to be
                returned. Omit parameter to return staff appointments for all staff.
            request_start_date (datetime, optional): The start date of the requested
                date range. If omitted, the default is used.   <br />Default:
                **today's date**
            request_use_site_settings_staff_name (bool, optional): When `true`, the
                staff DisplayName will be populated based on site-level settings.
                When `false` or omitted, the staff DisplayName will contain only the
                FirstName.

        Returns:
            GetStaffAppointmentsResponse: Response from the API. OK

        Raises:
            APIException: When an error occurs while fetching the data from the
                remote API. This exception includes the HTTP Response code, an error
                message, and the HTTP body that was received in the request.

        """
        return super().new_api_call_builder.request(
            RequestBuilder().server(Server.DEFAULT)
            .path("/public/v{version}/appointment/staffappointments")
            .http_method(HttpMethodEnum.GET)
            .template_param(Parameter()
                .key("version")
                .value(version)
                .should_encode(True))
            .header_param(Parameter()
                .key("siteId")
                .value(site_id))
            .header_param(Parameter()
                .key("authorization")
                .value(authorization))
            .query_param(Parameter()
                .key("request.appointmentIds")
                .value(request_appointment_ids))
            .query_param(Parameter()
                .key("request.clientId")
                .value(request_client_id))
            .query_param(Parameter()
                .key("request.endDate")
                .value(APIHelper.when_defined(APIHelper.RFC3339DateTime,
                    request_end_date)))
            .query_param(Parameter()
                .key("request.limit")
                .value(request_limit))
            .query_param(Parameter()
                .key("request.locationIds")
                .value(request_location_ids))
            .query_param(Parameter()
                .key("request.offset")
                .value(request_offset))
            .query_param(Parameter()
                .key("request.staffIds")
                .value(request_staff_ids))
            .query_param(Parameter()
                .key("request.startDate")
                .value(APIHelper.when_defined(APIHelper.RFC3339DateTime,
                    request_start_date)))
            .query_param(Parameter()
                .key("request.useSiteSettingsStaffName")
                .value(request_use_site_settings_staff_name))
            .header_param(Parameter()
                .key("accept")
                .value("application/json"))
            .auth(Single("API-Key")),
        ).response(
            ResponseHandler()
            .deserializer(APIHelper.json_deserialize)
            .deserialize_into(GetStaffAppointmentsResponse.from_dictionary),
        ).execute()

    def get_unavailabilities(self,
                             version,
                             site_id,
                             authorization=None,
                             request_end_date=None,
                             request_limit=None,
                             request_offset=None,
                             request_staff_ids=None,
                             request_start_date=None):
        """Perform a GET request to
        /public/v{version}/appointment/unavailabilities.

        Returns a list of unavailabilities. Unavailabilities are the times at which
        appointments cannot be booked, for example, on holidays or after hours when
        the business is closed.

        Args:
            version (str): version of the api.
            site_id (str): ID of the site from which to pull data.
            authorization (str, optional): A staff user authorization token.
            request_end_date (datetime, optional): The end date of the requested date
                range.   <br />Default: **today’s date**
            request_limit (int, optional): Number of results to include, defaults to
                100
            request_offset (int, optional): Page offset, defaults to 0.
            request_staff_ids (List[int], optional): A list of requested staff IDs.
            request_start_date (datetime, optional): The start date of the requested
                date range.   <br />Default: **today’s date**

        Returns:
            GetUnavailabilitiesResponse: Response from the API. OK

        Raises:
            APIException: When an error occurs while fetching the data from the
                remote API. This exception includes the HTTP Response code, an error
                message, and the HTTP body that was received in the request.

        """
        return super().new_api_call_builder.request(
            RequestBuilder().server(Server.DEFAULT)
            .path("/public/v{version}/appointment/unavailabilities")
            .http_method(HttpMethodEnum.GET)
            .template_param(Parameter()
                .key("version")
                .value(version)
                .should_encode(True))
            .header_param(Parameter()
                .key("siteId")
                .value(site_id))
            .header_param(Parameter()
                .key("authorization")
                .value(authorization))
            .query_param(Parameter()
                .key("request.endDate")
                .value(APIHelper.when_defined(APIHelper.RFC3339DateTime,
                    request_end_date)))
            .query_param(Parameter()
                .key("request.limit")
                .value(request_limit))
            .query_param(Parameter()
                .key("request.offset")
                .value(request_offset))
            .query_param(Parameter()
                .key("request.staffIds")
                .value(request_staff_ids))
            .query_param(Parameter()
                .key("request.startDate")
                .value(APIHelper.when_defined(APIHelper.RFC3339DateTime,
                    request_start_date)))
            .header_param(Parameter()
                .key("accept")
                .value("application/json"))
            .auth(Single("API-Key")),
        ).response(
            ResponseHandler()
            .deserializer(APIHelper.json_deserialize)
            .deserialize_into(GetUnavailabilitiesResponse.from_dictionary),
        ).execute()

    def add_appointment(self,
                        version,
                        request,
                        site_id,
                        authorization=None):
        """Perform a POST request to
        /public/v{version}/appointment/addappointment.

        A user token is required for this endpoint. To book an appointment, you must
        use a location ID, staff ID, client ID, session type ID, and the
        StartDateTime of the appointment. You can get most of this information using
        GET BookableItems.
        Note: Request deduplication is enabled for this endpoint. More information
        can be found in the [Request Deduplication
        Page](https://developers.mindbodyonline.com/ui/documentation/public-api#/net-s
        tandard-library/mindbody-public-api-v6-0/request-deduplication).
        Use the `X-RequestDeduplication-Skip` header to bypass deduplication if
        necessary. This may be useful in scenarios where you want to ensure a new
        appointment is created regardless of previous identical requests.

        Args:
            version (str): version of the api.
            request (AddAppointmentRequest): The request body parameter.
            site_id (str): ID of the site from which to pull data.
            authorization (str, optional): A staff user authorization token.

        Returns:
            AddAppointmentResponse: Response from the API. OK

        Raises:
            APIException: When an error occurs while fetching the data from the
                remote API. This exception includes the HTTP Response code, an error
                message, and the HTTP body that was received in the request.

        """
        return super().new_api_call_builder.request(
            RequestBuilder().server(Server.DEFAULT)
            .path("/public/v{version}/appointment/addappointment")
            .http_method(HttpMethodEnum.POST)
            .template_param(Parameter()
                .key("version")
                .value(version)
                .should_encode(True))
            .body_param(Parameter()
                .value(request))
            .header_param(Parameter()
                .key("siteId")
                .value(site_id))
            .header_param(Parameter()
                .key("Content-Type")
                .value("application/json"))
            .header_param(Parameter()
                .key("authorization")
                .value(authorization))
            .header_param(Parameter()
                .key("accept")
                .value("application/json"))
            .body_serializer(APIHelper.json_serialize)
            .auth(Single("API-Key")),
        ).response(
            ResponseHandler()
            .deserializer(APIHelper.json_deserialize)
            .deserialize_into(AddAppointmentResponse.from_dictionary),
        ).execute()

    def add_appointment_add_on(self,
                               version,
                               request,
                               site_id,
                               authorization=None):
        """Perform a POST request to
        /public/v{version}/appointment/addappointmentaddon.

        This endpoint books an add-on on top of an existing, regular appointment. To
        book an add-on, you must use an existing appointment ID and session type ID.
        You can get a session type ID using `GET AppointmentAddOns`.

        Args:
            version (str): version of the api.
            request (AddAppointmentAddOnRequest): The request body parameter.
            site_id (str): ID of the site from which to pull data.
            authorization (str, optional): A staff user authorization token.

        Returns:
            AddAppointmentAddOnResponse: Response from the API. Created

        Raises:
            APIException: When an error occurs while fetching the data from the
                remote API. This exception includes the HTTP Response code, an error
                message, and the HTTP body that was received in the request.

        """
        return super().new_api_call_builder.request(
            RequestBuilder().server(Server.DEFAULT)
            .path("/public/v{version}/appointment/addappointmentaddon")
            .http_method(HttpMethodEnum.POST)
            .template_param(Parameter()
                .key("version")
                .value(version)
                .should_encode(True))
            .body_param(Parameter()
                .value(request))
            .header_param(Parameter()
                .key("siteId")
                .value(site_id))
            .header_param(Parameter()
                .key("Content-Type")
                .value("application/json"))
            .header_param(Parameter()
                .key("authorization")
                .value(authorization))
            .header_param(Parameter()
                .key("accept")
                .value("application/json"))
            .body_serializer(APIHelper.json_serialize)
            .auth(Single("API-Key")),
        ).response(
            ResponseHandler()
            .deserializer(APIHelper.json_deserialize)
            .deserialize_into(AddAppointmentAddOnResponse.from_dictionary),
        ).execute()

    def add_multiple_appointments(self,
                                  version,
                                  request,
                                  site_id,
                                  authorization=None):
        """Perform a POST request to
        /public/v{version}/appointment/addmultipleappointments.

        A user token is required for this endpoint. To book appointments, you must
        provide a location ID, staff ID, client ID, session type ID, and the
        StartDateTime for each appointment.
        You can retrieve most of this information using the GET BookableItems
        endpoint.
        This endpoint will handle errors that occur during the appointment creation
        process and return a list of errors, as well as the request object that
        generated each outcome.
        You can pass the AddAppointmentRequestId for each request, or it will be
        automatically filled. This is intended to facilitate matching each request
        with the corresponding outcome.
        This endpoint will send one notification when multiple Appointments are
        booked by one Client on a given day.

        Args:
            version (str): version of the api.
            request (AddMultipleAppointmentsRequest): The request body parameter.
            site_id (str): ID of the site from which to pull data.
            authorization (str, optional): A staff user authorization token.

        Returns:
            AddMultipleAppointmentsResponse: Response from the API. OK

        Raises:
            APIException: When an error occurs while fetching the data from the
                remote API. This exception includes the HTTP Response code, an error
                message, and the HTTP body that was received in the request.

        """
        return super().new_api_call_builder.request(
            RequestBuilder().server(Server.DEFAULT)
            .path("/public/v{version}/appointment/addmultipleappointments")
            .http_method(HttpMethodEnum.POST)
            .template_param(Parameter()
                .key("version")
                .value(version)
                .should_encode(True))
            .body_param(Parameter()
                .value(request))
            .header_param(Parameter()
                .key("siteId")
                .value(site_id))
            .header_param(Parameter()
                .key("Content-Type")
                .value("application/json"))
            .header_param(Parameter()
                .key("authorization")
                .value(authorization))
            .header_param(Parameter()
                .key("accept")
                .value("application/json"))
            .body_serializer(APIHelper.json_serialize)
            .auth(Single("API-Key")),
        ).response(
            ResponseHandler()
            .deserializer(APIHelper.json_deserialize)
            .deserialize_into(AddMultipleAppointmentsResponse.from_dictionary),
        ).execute()

    def update_availability(self,
                            version,
                            site_id,
                            update_availability_request,
                            authorization=None):
        """Perform a PUT request to
        /public/v{version}/appointment/availabilities.

        To update the information for a specific availability or unavailability of
        the staff.<br />
        Note: You must have a staff user token with the required permissions.

        Args:
            version (str): version of the api.
            site_id (str): ID of the site from which to pull data.
            update_availability_request (UpdateAvailabilityRequest): The request body
                parameter.
            authorization (str, optional): A staff user authorization token.

        Returns:
            UpdateAvailabilityResponse: Response from the API. OK

        Raises:
            APIException: When an error occurs while fetching the data from the
                remote API. This exception includes the HTTP Response code, an error
                message, and the HTTP body that was received in the request.

        """
        return super().new_api_call_builder.request(
            RequestBuilder().server(Server.DEFAULT)
            .path("/public/v{version}/appointment/availabilities")
            .http_method(HttpMethodEnum.PUT)
            .template_param(Parameter()
                .key("version")
                .value(version)
                .should_encode(True))
            .header_param(Parameter()
                .key("siteId")
                .value(site_id))
            .body_param(Parameter()
                .value(update_availability_request))
            .header_param(Parameter()
                .key("Content-Type")
                .value("application/json"))
            .header_param(Parameter()
                .key("authorization")
                .value(authorization))
            .header_param(Parameter()
                .key("accept")
                .value("application/json"))
            .body_serializer(APIHelper.json_serialize)
            .auth(Single("API-Key")),
        ).response(
            ResponseHandler()
            .deserializer(APIHelper.json_deserialize)
            .deserialize_into(UpdateAvailabilityResponse.from_dictionary),
        ).execute()

    def add_availabilities(self,
                           version,
                           request,
                           site_id,
                           authorization=None):
        """Perform a POST request to
        /public/v{version}/appointment/availabilities.

        Add availabilities and unavailabilities for a staff member.<br />
        Note: You must have a staff user token with the required permissions.

        Args:
            version (str): version of the api.
            request (AddAvailabilitiesRequest): The request body parameter.
            site_id (str): ID of the site from which to pull data.
            authorization (str, optional): A staff user authorization token.

        Returns:
            AddAvailabilitiesResponse: Response from the API. OK

        Raises:
            APIException: When an error occurs while fetching the data from the
                remote API. This exception includes the HTTP Response code, an error
                message, and the HTTP body that was received in the request.

        """
        return super().new_api_call_builder.request(
            RequestBuilder().server(Server.DEFAULT)
            .path("/public/v{version}/appointment/availabilities")
            .http_method(HttpMethodEnum.POST)
            .template_param(Parameter()
                .key("version")
                .value(version)
                .should_encode(True))
            .body_param(Parameter()
                .value(request))
            .header_param(Parameter()
                .key("siteId")
                .value(site_id))
            .header_param(Parameter()
                .key("Content-Type")
                .value("application/json"))
            .header_param(Parameter()
                .key("authorization")
                .value(authorization))
            .header_param(Parameter()
                .key("accept")
                .value("application/json"))
            .body_serializer(APIHelper.json_serialize)
            .auth(Single("API-Key")),
        ).response(
            ResponseHandler()
            .deserializer(APIHelper.json_deserialize)
            .deserialize_into(AddAvailabilitiesResponse.from_dictionary),
        ).execute()

    def update_appointment(self,
                           version,
                           request,
                           site_id,
                           authorization=None):
        """Perform a POST request to
        /public/v{version}/appointment/updateappointment.

        To update the information for a specific appointment, you must have a staff
        user token with the proper permissions. Note that you can only update the
        appointment’s `StartDateTime`, `EndDateTime`, `StaffId`, `Notes`, and
        `SessionTypeId`.

        Args:
            version (str): version of the api.
            request (UpdateAppointmentRequest): The request body parameter.
            site_id (str): ID of the site from which to pull data.
            authorization (str, optional): A staff user authorization token.

        Returns:
            UpdateAppointmentResponse: Response from the API. OK

        Raises:
            APIException: When an error occurs while fetching the data from the
                remote API. This exception includes the HTTP Response code, an error
                message, and the HTTP body that was received in the request.

        """
        return super().new_api_call_builder.request(
            RequestBuilder().server(Server.DEFAULT)
            .path("/public/v{version}/appointment/updateappointment")
            .http_method(HttpMethodEnum.POST)
            .template_param(Parameter()
                .key("version")
                .value(version)
                .should_encode(True))
            .body_param(Parameter()
                .value(request))
            .header_param(Parameter()
                .key("siteId")
                .value(site_id))
            .header_param(Parameter()
                .key("Content-Type")
                .value("application/json"))
            .header_param(Parameter()
                .key("authorization")
                .value(authorization))
            .header_param(Parameter()
                .key("accept")
                .value("application/json"))
            .body_serializer(APIHelper.json_serialize)
            .auth(Single("API-Key")),
        ).response(
            ResponseHandler()
            .deserializer(APIHelper.json_deserialize)
            .deserialize_into(UpdateAppointmentResponse.from_dictionary),
        ).execute()

    def remove_from_waitlist(self,
                             version,
                             request_waitlist_entry_ids,
                             site_id,
                             authorization=None):
        """Perform a DELETE request to
        /public/v{version}/appointment/appointmentfromwaitlist.

        Remove an appointment from waitlist

        Args:
            version (str): version of the api.
            request_waitlist_entry_ids (List[int]): A list of `WaitlistEntryIds` to
                remove from the waiting list.
            site_id (str): ID of the site from which to pull data.
            authorization (str, optional): A staff user authorization token.

        Returns:
            void: Response from the API. This endpoint does not return a response. If
                a call to this endpoint results in a 204 No Content HTTP status code,
                then the call was successful.

        Raises:
            APIException: When an error occurs while fetching the data from the
                remote API. This exception includes the HTTP Response code, an error
                message, and the HTTP body that was received in the request.

        """
        return super().new_api_call_builder.request(
            RequestBuilder().server(Server.DEFAULT)
            .path("/public/v{version}/appointment/appointmentfromwaitlist")
            .http_method(HttpMethodEnum.DELETE)
            .template_param(Parameter()
                .key("version")
                .value(version)
                .should_encode(True))
            .query_param(Parameter()
                .key("request.waitlistEntryIds")
                .value(request_waitlist_entry_ids))
            .header_param(Parameter()
                .key("siteId")
                .value(site_id))
            .header_param(Parameter()
                .key("authorization")
                .value(authorization))
            .auth(Single("API-Key")),
        ).execute()

    def delete_availability(self,
                            version,
                            site_id,
                            authorization=None,
                            delete_availability_request_availability_id=None,
                            delete_availability_request_test=None):
        """Perform a DELETE request to
        /public/v{version}/appointment/availability.

        This endpoint deletes the availability or unavailability.
        Note: You must have a staff user token with the required permissions.

        Args:
            version (str): version of the api.
            site_id (str): ID of the site from which to pull data.
            authorization (str, optional): A staff user authorization token.
            delete_availability_request_availability_id (int, optional): The ID of
                the availability or unavailability.
            delete_availability_request_test (bool, optional): When `true`, indicates
                that this is a test request and no data is deleted from the
                subscriber’s database.  When `false`, the record will be deleted.
                Default: **false**

        Returns:
            void: Response from the API. This endpoint does not return a response. If
                a call to this endpoint results in a 204 NoContent HTTP status code,
                then the call was successful.

        Raises:
            APIException: When an error occurs while fetching the data from the
                remote API. This exception includes the HTTP Response code, an error
                message, and the HTTP body that was received in the request.

        """
        return super().new_api_call_builder.request(
            RequestBuilder().server(Server.DEFAULT)
            .path("/public/v{version}/appointment/availability")
            .http_method(HttpMethodEnum.DELETE)
            .template_param(Parameter()
                .key("version")
                .value(version)
                .should_encode(True))
            .header_param(Parameter()
                .key("siteId")
                .value(site_id))
            .header_param(Parameter()
                .key("authorization")
                .value(authorization))
            .query_param(Parameter()
                .key("deleteAvailabilityRequest.availabilityId")
                .value(delete_availability_request_availability_id))
            .query_param(Parameter()
                .key("deleteAvailabilityRequest.test")
                .value(delete_availability_request_test))
            .auth(Single("API-Key")),
        ).execute()

    def delete_appointment_add_on(self,
                                  version,
                                  id,
                                  site_id,
                                  authorization=None):
        """Perform a DELETE request to
        /public/v{version}/appointment/deleteappointmentaddon.

        This endpoint can be used to early-cancel a booked appointment add-on.

        Args:
            version (str): version of the api.
            id (int): The request query parameter.
            site_id (str): ID of the site from which to pull data.
            authorization (str, optional): A staff user authorization token.

        Returns:
            void: Response from the API. This endpoint does not return a response. If
                a call to this endpoint results in a 204 No Content HTTP status code,
                then the call was successful.

        Raises:
            APIException: When an error occurs while fetching the data from the
                remote API. This exception includes the HTTP Response code, an error
                message, and the HTTP body that was received in the request.

        """
        return super().new_api_call_builder.request(
            RequestBuilder().server(Server.DEFAULT)
            .path("/public/v{version}/appointment/deleteappointmentaddon")
            .http_method(HttpMethodEnum.DELETE)
            .template_param(Parameter()
                .key("version")
                .value(version)
                .should_encode(True))
            .query_param(Parameter()
                .key("id")
                .value(id))
            .header_param(Parameter()
                .key("siteId")
                .value(site_id))
            .header_param(Parameter()
                .key("authorization")
                .value(authorization))
            .auth(Single("API-Key")),
        ).execute()
