"""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_staff_response import (
    AddStaffResponse,
)
from mindbodypublicapi.models.assign_staff_session_type_response import (
    AssignStaffSessionTypeResponse,
)
from mindbodypublicapi.models.get_sales_reps_response import (
    GetSalesRepsResponse,
)
from mindbodypublicapi.models.get_staff_image_url_response import (
    GetStaffImageURLResponse,
)
from mindbodypublicapi.models.get_staff_permissions_response import (
    GetStaffPermissionsResponse,
)
from mindbodypublicapi.models.get_staff_response import (
    GetStaffResponse,
)
from mindbodypublicapi.models.get_staff_session_types_response import (
    GetStaffSessionTypesResponse,
)
from mindbodypublicapi.models.update_staff_permissions_response import (
    UpdateStaffPermissionsResponse,
)
from mindbodypublicapi.models.update_staff_response import (
    UpdateStaffResponse,
)


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

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

    def get_staff_image_url(self,
                            version,
                            site_id,
                            authorization=None,
                            request_staff_id=None):
        """Perform a GET request to /public/v{version}/staff/imageurl.

        Retrieves the available image URLs for a specified staff member, including
        desktop and mobile versions.
        <br />
        The resolution of these images is determined by the Mindbody product at the
        time the image is uploaded. Staff images are automatically resized within
        Core (typically around 200×151 pixels), and this endpoint surfaces only the
        stored versions. The API does not resize or limit the images itself .
        <br />
        For more information about how image sizes are managed in Mindbody product,
        refer to the related support article: [link
        here](https://support.mindbodyonline.com/s/article/203253783-Staff-profiles-Cr
        eating-logins-updating-info-and-enabling-settings?language=en_US).

        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_staff_id (int, optional): The ID of the staff member whose image
                URL details you want to retrieve.

        Returns:
            GetStaffImageURLResponse: 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}/staff/imageurl")
            .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.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(GetStaffImageURLResponse.from_dictionary),
        ).execute()

    def get_sales_reps(self,
                       version,
                       site_id,
                       authorization=None,
                       request_active_only=None,
                       request_limit=None,
                       request_offset=None,
                       request_sales_rep_numbers=None):
        """Perform a GET request to /public/v{version}/staff/salesreps.

        This endpoint returns the basic details of the staffs that are marked as
        sales reps.

        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_active_only (bool, optional): When `true`, will return only
                active reps data.  Default : **false**
            request_limit (int, optional): Number of results to include, defaults to
                100
            request_offset (int, optional): Page offset, defaults to 0.
            request_sales_rep_numbers (List[int], optional): This is the list of the
                sales rep numbers for which the salesrep data will be fetched.

        Returns:
            GetSalesRepsResponse: 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}/staff/salesreps")
            .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.activeOnly")
                .value(request_active_only))
            .query_param(Parameter()
                .key("request.limit")
                .value(request_limit))
            .query_param(Parameter()
                .key("request.offset")
                .value(request_offset))
            .query_param(Parameter()
                .key("request.salesRepNumbers")
                .value(request_sales_rep_numbers))
            .header_param(Parameter()
                .key("accept")
                .value("application/json"))
            .auth(Single("API-Key")),
        ).response(
            ResponseHandler()
            .deserializer(APIHelper.json_deserialize)
            .deserialize_into(GetSalesRepsResponse.from_dictionary),
        ).execute()

    def get_staff_session_types(self,
                                version,
                                request_staff_id,
                                site_id,
                                authorization=None,
                                request_limit=None,
                                request_offset=None,
                                request_online_only=None,
                                request_program_ids=None):
        """Perform a GET request to /public/v{version}/staff/sessiontypes.

        Gets a list of active session types for a specific staff member. A staff user
        token must be included with staff assigned the ManageStaffPayRates permission.

        Args:
            version (str): version of the api.
            request_staff_id (int): The ID of the staff member whose session types
                you want to return.
            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_online_only (bool, optional): When `true`, indicates that only
                the session types that can be booked online should be returned.
                Default: **false**
            request_program_ids (List[int], optional): Filters results to session
                types that belong to one of the given program IDs. If omitted, all
                program IDs return.

        Returns:
            GetStaffSessionTypesResponse: 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}/staff/sessiontypes")
            .http_method(HttpMethodEnum.GET)
            .template_param(Parameter()
                .key("version")
                .value(version)
                .should_encode(True))
            .query_param(Parameter()
                .key("request.staffId")
                .value(request_staff_id))
            .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.onlineOnly")
                .value(request_online_only))
            .query_param(Parameter()
                .key("request.programIds")
                .value(request_program_ids))
            .header_param(Parameter()
                .key("accept")
                .value("application/json"))
            .auth(Single("API-Key")),
        ).response(
            ResponseHandler()
            .deserializer(APIHelper.json_deserialize)
            .deserialize_into(GetStaffSessionTypesResponse.from_dictionary),
        ).execute()

    def get_staff(self,
                  version,
                  site_id,
                  authorization=None,
                  request_filters=None,
                  request_limit=None,
                  request_location_id=None,
                  request_offset=None,
                  request_session_type_id=None,
                  request_staff_ids=None,
                  request_start_date_time=None):
        """Perform a GET request to /public/v{version}/staff/staff.

        When a user token is not passed with the request or the passed user token has
        insufficient viewing permissions, only the following staff data is returned
        in the response:

        * FirstName
        * LastName
        * Id
        * Bio
        * DisplayName
        * ImageUrl
        * EmpID

        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_filters (List[str], optional): Filters to apply to the search.
                Possible values are:  * StaffViewable  * AppointmentInstructor  *
                ClassInstructor  * Male  * Female
            request_limit (int, optional): Number of results to include, defaults to
                100
            request_location_id (int, optional): Return only staff members that are
                available at the specified location. You must supply a valid
                `SessionTypeID` and `StartDateTime` to use this parameter.
            request_offset (int, optional): Page offset, defaults to 0.
            request_session_type_id (int, optional): Return only staff members that
                are available for the specified session type. You must supply a valid
                `StartDateTime` and `LocationID` to use this parameter.
            request_staff_ids (List[int], optional): A list of the requested staff
                IDs.
            request_start_date_time (datetime, optional): Return only staff members
                that are available at the specified date and time. You must supply a
                valid `SessionTypeID` and `LocationID` to use this parameter.

        Returns:
            GetStaffResponse: 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}/staff/staff")
            .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.filters")
                .value(request_filters))
            .query_param(Parameter()
                .key("request.limit")
                .value(request_limit))
            .query_param(Parameter()
                .key("request.locationId")
                .value(request_location_id))
            .query_param(Parameter()
                .key("request.offset")
                .value(request_offset))
            .query_param(Parameter()
                .key("request.sessionTypeId")
                .value(request_session_type_id))
            .query_param(Parameter()
                .key("request.staffIds")
                .value(request_staff_ids))
            .query_param(Parameter()
                .key("request.startDateTime")
                .value(APIHelper.when_defined(APIHelper.RFC3339DateTime,
                    request_start_date_time)))
            .header_param(Parameter()
                .key("accept")
                .value("application/json"))
            .auth(Single("API-Key")),
        ).response(
            ResponseHandler()
            .deserializer(APIHelper.json_deserialize)
            .deserialize_into(GetStaffResponse.from_dictionary),
        ).execute()

    def get_staff_permissions(self,
                              version,
                              request_staff_id,
                              site_id,
                              authorization=None):
        """Perform a GET request to /public/v{version}/staff/staffpermissions.

        Get configured staff permissions for a staff member.

        Args:
            version (str): version of the api.
            request_staff_id (int): The ID of the staff member whose permissions you
                want to return.
            site_id (str): ID of the site from which to pull data.
            authorization (str, optional): A staff user authorization token.

        Returns:
            GetStaffPermissionsResponse: 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}/staff/staffpermissions")
            .http_method(HttpMethodEnum.GET)
            .template_param(Parameter()
                .key("version")
                .value(version)
                .should_encode(True))
            .query_param(Parameter()
                .key("request.staffId")
                .value(request_staff_id))
            .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(GetStaffPermissionsResponse.from_dictionary),
        ).execute()

    def add_staff(self,
                  version,
                  request,
                  site_id,
                  authorization=None):
        """Perform a POST request to /public/v{version}/staff/addstaff.

        Creates a new staff member record at the specified business. The `FirstName`
        and `LastName` parameters are always required for this request.

        Args:
            version (str): version of the api.
            request (AddStaffRequest): 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:
            AddStaffResponse: 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}/staff/addstaff")
            .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(AddStaffResponse.from_dictionary),
        ).execute()

    def assign_staff_session_type(self,
                                  version,
                                  request,
                                  site_id,
                                  authorization=None):
        """Perform a POST request to
        /public/v{version}/staff/assignsessiontype.

        Assigns a staff member to an appointment session type with staff specific
        properties such as time length and pay rate. A staff user token must be
        included with staff assigned the ManageStaffPayRates permission.

        Args:
            version (str): version of the api.
            request (AssignStaffSessionTypeRequest): 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:
            AssignStaffSessionTypeResponse: 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}/staff/assignsessiontype")
            .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(AssignStaffSessionTypeResponse.from_dictionary),
        ).execute()

    def add_staff_availability(self,
                               version,
                               request,
                               site_id,
                               authorization=None):
        """Perform a POST request to
        /public/v{version}/staff/staffavailability.

        Enables to add staff availability or unavailability for a given staff member.

        Args:
            version (str): version of the api.
            request (AddStaffAvailabilityRequest): 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:
            void: 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}/staff/staffavailability")
            .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))
            .body_serializer(APIHelper.json_serialize)
            .auth(Single("API-Key")),
        ).execute()

    def update_staff(self,
                     version,
                     request,
                     site_id,
                     authorization=None):
        """Perform a POST request to /public/v{version}/staff/updatestaff.

        Updates an existing staff member record at the specified business. The ID is
        a required parameters for this request.

        Args:
            version (str): version of the api.
            request (UpdateStaffRequest): 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:
            UpdateStaffResponse: 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}/staff/updatestaff")
            .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(UpdateStaffResponse.from_dictionary),
        ).execute()

    def update_staff_permissions(self,
                                 version,
                                 request,
                                 site_id,
                                 authorization=None):
        """Perform a POST request to
        /public/v{version}/staff/updatestaffpermissions.

        Assigns a permission group to a staff member. A staff user token must be
        included with staff assigned the ManageStaffPayRates permission.

        Args:
            version (str): version of the api.
            request (UpdateStaffPermissionsRequest): 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:
            UpdateStaffPermissionsResponse: 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}/staff/updatestaffpermissions")
            .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(UpdateStaffPermissionsResponse.from_dictionary),
        ).execute()
