# coding: utf-8

"""
    BioT Device Service

    APIs document (version: 8.9.1)

    The version of the OpenAPI document: 8.9.1
    Generated by OpenAPI Generator (https://openapi-generator.tech)

    Do not edit the class manually.
"""  # noqa: E501

import warnings
from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt
from typing import Any, Dict, List, Optional, Tuple, Union
from typing_extensions import Annotated

from pydantic import Field, StrictStr, field_validator
from typing import Optional
from typing_extensions import Annotated
from uuid import UUID
from biotmed_device_sdk.models.create_alert_by_template_name_request import CreateAlertByTemplateNameRequest
from biotmed_device_sdk.models.create_alert_request import CreateAlertRequest
from biotmed_device_sdk.models.device_alert_response import DeviceAlertResponse
from biotmed_device_sdk.models.search_request_v2 import SearchRequestV2
from biotmed_device_sdk.models.search_response_device_alert_response import SearchResponseDeviceAlertResponse
from biotmed_device_sdk.models.search_response_device_owned_alert_response import SearchResponseDeviceOwnedAlertResponse
from biotmed_device_sdk.models.update_alert_request import UpdateAlertRequest

from biotmed_device_sdk.api_client import ApiClient, RequestSerialized
from biotmed_device_sdk.api_response import ApiResponse
from biotmed_device_sdk.rest import RESTResponseType


class DeviceAlertAPIApi:
    """NOTE: This class is auto generated by OpenAPI Generator
    Ref: https://openapi-generator.tech

    Do not edit the class manually.
    """

    def __init__(self, api_client=None) -> None:
        if api_client is None:
            api_client = ApiClient.get_default()
        self.api_client = api_client


    @validate_call
    def create_alert(
        self,
        create_alert_request: CreateAlertRequest,
        device_id: StrictStr,
        x_execution_mode: Annotated[Optional[StrictStr], Field(description="X-Execution-Mode — Optional header to control execution mode.  Use sync to make the API wait until all background operations complete before returning a response.  If omitted, the request is processed asynchronously (default). ")] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> DeviceAlertResponse:
        """Create a new Device Alert by Template id

        Create a new Device Alert by Template id    Request Body Parameters:  | Parameter   |Type   | Mandatory| Description          | Example   | |-------------|-------|----------|----------------------|-----------| |&lt;customAttribute1&gt;|&lt;customAttribute1Type&gt;|false|Regular custom attribute 1 value|| |&lt;customAttributeN&gt;|&lt;customAttributeNType&gt;|false|Regular custom attribute N value|| |_clearNotes|string|false|Clear notes|| |_name|string|false|The name of the alert|| |_severity|string|false|The alert wanted severity Values:CRITICAL,MAJOR,MINOR,INFO Default:INFO|MAJOR| |_state|string|false|The alert wanted state Values:ACTIVE,CLEARED,SUSPENDED Default:ACTIVE|ACTIVE| |_templateId|string|true|The id of a template that is configured in the settings service.|3fa85f64-5717-4562-b3fc-2c963f66afa6| Path Parameters:  | Parameter   |Type   | Mandatory| Description          | Example   | |-------------|-------|----------|----------------------|-----------| |deviceId|string|true|null||   This API requires **PROTECTED_API** permission(s).  

        :param create_alert_request: (required)
        :type create_alert_request: CreateAlertRequest
        :param device_id: (required)
        :type device_id: str
        :param x_execution_mode: X-Execution-Mode — Optional header to control execution mode.  Use sync to make the API wait until all background operations complete before returning a response.  If omitted, the request is processed asynchronously (default). 
        :type x_execution_mode: str
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._create_alert_serialize(
            create_alert_request=create_alert_request,
            device_id=device_id,
            x_execution_mode=x_execution_mode,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '400': "ErrorResponse",
            '201': "DeviceAlertResponse",
            '500': "ErrorResponse",
            '401': "ErrorResponse",
            '403': "ErrorResponse",
            '404': "ErrorResponse",
            '504': "ErrorResponse",
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        ).data


    @validate_call
    def create_alert_with_http_info(
        self,
        create_alert_request: CreateAlertRequest,
        device_id: StrictStr,
        x_execution_mode: Annotated[Optional[StrictStr], Field(description="X-Execution-Mode — Optional header to control execution mode.  Use sync to make the API wait until all background operations complete before returning a response.  If omitted, the request is processed asynchronously (default). ")] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> ApiResponse[DeviceAlertResponse]:
        """Create a new Device Alert by Template id

        Create a new Device Alert by Template id    Request Body Parameters:  | Parameter   |Type   | Mandatory| Description          | Example   | |-------------|-------|----------|----------------------|-----------| |&lt;customAttribute1&gt;|&lt;customAttribute1Type&gt;|false|Regular custom attribute 1 value|| |&lt;customAttributeN&gt;|&lt;customAttributeNType&gt;|false|Regular custom attribute N value|| |_clearNotes|string|false|Clear notes|| |_name|string|false|The name of the alert|| |_severity|string|false|The alert wanted severity Values:CRITICAL,MAJOR,MINOR,INFO Default:INFO|MAJOR| |_state|string|false|The alert wanted state Values:ACTIVE,CLEARED,SUSPENDED Default:ACTIVE|ACTIVE| |_templateId|string|true|The id of a template that is configured in the settings service.|3fa85f64-5717-4562-b3fc-2c963f66afa6| Path Parameters:  | Parameter   |Type   | Mandatory| Description          | Example   | |-------------|-------|----------|----------------------|-----------| |deviceId|string|true|null||   This API requires **PROTECTED_API** permission(s).  

        :param create_alert_request: (required)
        :type create_alert_request: CreateAlertRequest
        :param device_id: (required)
        :type device_id: str
        :param x_execution_mode: X-Execution-Mode — Optional header to control execution mode.  Use sync to make the API wait until all background operations complete before returning a response.  If omitted, the request is processed asynchronously (default). 
        :type x_execution_mode: str
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._create_alert_serialize(
            create_alert_request=create_alert_request,
            device_id=device_id,
            x_execution_mode=x_execution_mode,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '400': "ErrorResponse",
            '201': "DeviceAlertResponse",
            '500': "ErrorResponse",
            '401': "ErrorResponse",
            '403': "ErrorResponse",
            '404': "ErrorResponse",
            '504': "ErrorResponse",
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        )


    @validate_call
    def create_alert_without_preload_content(
        self,
        create_alert_request: CreateAlertRequest,
        device_id: StrictStr,
        x_execution_mode: Annotated[Optional[StrictStr], Field(description="X-Execution-Mode — Optional header to control execution mode.  Use sync to make the API wait until all background operations complete before returning a response.  If omitted, the request is processed asynchronously (default). ")] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> RESTResponseType:
        """Create a new Device Alert by Template id

        Create a new Device Alert by Template id    Request Body Parameters:  | Parameter   |Type   | Mandatory| Description          | Example   | |-------------|-------|----------|----------------------|-----------| |&lt;customAttribute1&gt;|&lt;customAttribute1Type&gt;|false|Regular custom attribute 1 value|| |&lt;customAttributeN&gt;|&lt;customAttributeNType&gt;|false|Regular custom attribute N value|| |_clearNotes|string|false|Clear notes|| |_name|string|false|The name of the alert|| |_severity|string|false|The alert wanted severity Values:CRITICAL,MAJOR,MINOR,INFO Default:INFO|MAJOR| |_state|string|false|The alert wanted state Values:ACTIVE,CLEARED,SUSPENDED Default:ACTIVE|ACTIVE| |_templateId|string|true|The id of a template that is configured in the settings service.|3fa85f64-5717-4562-b3fc-2c963f66afa6| Path Parameters:  | Parameter   |Type   | Mandatory| Description          | Example   | |-------------|-------|----------|----------------------|-----------| |deviceId|string|true|null||   This API requires **PROTECTED_API** permission(s).  

        :param create_alert_request: (required)
        :type create_alert_request: CreateAlertRequest
        :param device_id: (required)
        :type device_id: str
        :param x_execution_mode: X-Execution-Mode — Optional header to control execution mode.  Use sync to make the API wait until all background operations complete before returning a response.  If omitted, the request is processed asynchronously (default). 
        :type x_execution_mode: str
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._create_alert_serialize(
            create_alert_request=create_alert_request,
            device_id=device_id,
            x_execution_mode=x_execution_mode,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '400': "ErrorResponse",
            '201': "DeviceAlertResponse",
            '500': "ErrorResponse",
            '401': "ErrorResponse",
            '403': "ErrorResponse",
            '404': "ErrorResponse",
            '504': "ErrorResponse",
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        return response_data.response


    def _create_alert_serialize(
        self,
        create_alert_request,
        device_id,
        x_execution_mode,
        _request_auth,
        _content_type,
        _headers,
        _host_index,
    ) -> RequestSerialized:

        _host = None

        _collection_formats: Dict[str, str] = {
        }

        _path_params: Dict[str, str] = {}
        _query_params: List[Tuple[str, str]] = []
        _header_params: Dict[str, Optional[str]] = _headers or {}
        _form_params: List[Tuple[str, str]] = []
        _files: Dict[
            str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
        ] = {}
        _body_params: Optional[bytes] = None

        # process the path parameters
        if device_id is not None:
            _path_params['deviceId'] = device_id
        # process the query parameters
        # process the header parameters
        if x_execution_mode is not None:
            _header_params['x-execution-mode'] = x_execution_mode
        # process the form parameters
        # process the body parameter
        if create_alert_request is not None:
            _body_params = create_alert_request


        # set the HTTP header `Accept`
        if 'Accept' not in _header_params:
            _header_params['Accept'] = self.api_client.select_header_accept(
                [
                    'application/json'
                ]
            )

        # set the HTTP header `Content-Type`
        if _content_type:
            _header_params['Content-Type'] = _content_type
        else:
            _default_content_type = (
                self.api_client.select_header_content_type(
                    [
                        'application/json'
                    ]
                )
            )
            if _default_content_type is not None:
                _header_params['Content-Type'] = _default_content_type

        # authentication setting
        _auth_settings: List[str] = [
            'bearerAuth'
        ]

        return self.api_client.param_serialize(
            method='POST',
            resource_path='/v1/devices/{deviceId}/alerts',
            path_params=_path_params,
            query_params=_query_params,
            header_params=_header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            auth_settings=_auth_settings,
            collection_formats=_collection_formats,
            _host=_host,
            _request_auth=_request_auth
        )




    @validate_call
    def create_alert_by_template_name(
        self,
        create_alert_by_template_name_request: CreateAlertByTemplateNameRequest,
        device_id: StrictStr,
        template_name: StrictStr,
        x_execution_mode: Annotated[Optional[StrictStr], Field(description="X-Execution-Mode — Optional header to control execution mode.  Use sync to make the API wait until all background operations complete before returning a response.  If omitted, the request is processed asynchronously (default). ")] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> DeviceAlertResponse:
        """Create a new Device Alert by Template name

        Create a new Device Alert by Template name    Request Body Parameters:  | Parameter   |Type   | Mandatory| Description          | Example   | |-------------|-------|----------|----------------------|-----------| |&lt;customAttribute1&gt;|&lt;customAttribute1Type&gt;|false|Regular custom attribute 1 value|| |&lt;customAttributeN&gt;|&lt;customAttributeNType&gt;|false|Regular custom attribute N value|| |_clearNotes|string|false|Clear notes|| |_name|string|false|The name of the alert|| |_severity|string|false|The alert wanted severity Values:CRITICAL,MAJOR,MINOR,INFO Default:INFO|MAJOR| |_state|string|false|The alert wanted state Values:ACTIVE,CLEARED,SUSPENDED Default:ACTIVE|ACTIVE| Path Parameters:  | Parameter   |Type   | Mandatory| Description          | Example   | |-------------|-------|----------|----------------------|-----------| |deviceId|string|true|null|| |templateName|string|true|null||   This API requires **PROTECTED_API** permission(s).  

        :param create_alert_by_template_name_request: (required)
        :type create_alert_by_template_name_request: CreateAlertByTemplateNameRequest
        :param device_id: (required)
        :type device_id: str
        :param template_name: (required)
        :type template_name: str
        :param x_execution_mode: X-Execution-Mode — Optional header to control execution mode.  Use sync to make the API wait until all background operations complete before returning a response.  If omitted, the request is processed asynchronously (default). 
        :type x_execution_mode: str
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._create_alert_by_template_name_serialize(
            create_alert_by_template_name_request=create_alert_by_template_name_request,
            device_id=device_id,
            template_name=template_name,
            x_execution_mode=x_execution_mode,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '400': "ErrorResponse",
            '201': "DeviceAlertResponse",
            '500': "ErrorResponse",
            '401': "ErrorResponse",
            '403': "ErrorResponse",
            '404': "ErrorResponse",
            '504': "ErrorResponse",
            '409': "ErrorResponse",
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        ).data


    @validate_call
    def create_alert_by_template_name_with_http_info(
        self,
        create_alert_by_template_name_request: CreateAlertByTemplateNameRequest,
        device_id: StrictStr,
        template_name: StrictStr,
        x_execution_mode: Annotated[Optional[StrictStr], Field(description="X-Execution-Mode — Optional header to control execution mode.  Use sync to make the API wait until all background operations complete before returning a response.  If omitted, the request is processed asynchronously (default). ")] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> ApiResponse[DeviceAlertResponse]:
        """Create a new Device Alert by Template name

        Create a new Device Alert by Template name    Request Body Parameters:  | Parameter   |Type   | Mandatory| Description          | Example   | |-------------|-------|----------|----------------------|-----------| |&lt;customAttribute1&gt;|&lt;customAttribute1Type&gt;|false|Regular custom attribute 1 value|| |&lt;customAttributeN&gt;|&lt;customAttributeNType&gt;|false|Regular custom attribute N value|| |_clearNotes|string|false|Clear notes|| |_name|string|false|The name of the alert|| |_severity|string|false|The alert wanted severity Values:CRITICAL,MAJOR,MINOR,INFO Default:INFO|MAJOR| |_state|string|false|The alert wanted state Values:ACTIVE,CLEARED,SUSPENDED Default:ACTIVE|ACTIVE| Path Parameters:  | Parameter   |Type   | Mandatory| Description          | Example   | |-------------|-------|----------|----------------------|-----------| |deviceId|string|true|null|| |templateName|string|true|null||   This API requires **PROTECTED_API** permission(s).  

        :param create_alert_by_template_name_request: (required)
        :type create_alert_by_template_name_request: CreateAlertByTemplateNameRequest
        :param device_id: (required)
        :type device_id: str
        :param template_name: (required)
        :type template_name: str
        :param x_execution_mode: X-Execution-Mode — Optional header to control execution mode.  Use sync to make the API wait until all background operations complete before returning a response.  If omitted, the request is processed asynchronously (default). 
        :type x_execution_mode: str
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._create_alert_by_template_name_serialize(
            create_alert_by_template_name_request=create_alert_by_template_name_request,
            device_id=device_id,
            template_name=template_name,
            x_execution_mode=x_execution_mode,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '400': "ErrorResponse",
            '201': "DeviceAlertResponse",
            '500': "ErrorResponse",
            '401': "ErrorResponse",
            '403': "ErrorResponse",
            '404': "ErrorResponse",
            '504': "ErrorResponse",
            '409': "ErrorResponse",
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        )


    @validate_call
    def create_alert_by_template_name_without_preload_content(
        self,
        create_alert_by_template_name_request: CreateAlertByTemplateNameRequest,
        device_id: StrictStr,
        template_name: StrictStr,
        x_execution_mode: Annotated[Optional[StrictStr], Field(description="X-Execution-Mode — Optional header to control execution mode.  Use sync to make the API wait until all background operations complete before returning a response.  If omitted, the request is processed asynchronously (default). ")] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> RESTResponseType:
        """Create a new Device Alert by Template name

        Create a new Device Alert by Template name    Request Body Parameters:  | Parameter   |Type   | Mandatory| Description          | Example   | |-------------|-------|----------|----------------------|-----------| |&lt;customAttribute1&gt;|&lt;customAttribute1Type&gt;|false|Regular custom attribute 1 value|| |&lt;customAttributeN&gt;|&lt;customAttributeNType&gt;|false|Regular custom attribute N value|| |_clearNotes|string|false|Clear notes|| |_name|string|false|The name of the alert|| |_severity|string|false|The alert wanted severity Values:CRITICAL,MAJOR,MINOR,INFO Default:INFO|MAJOR| |_state|string|false|The alert wanted state Values:ACTIVE,CLEARED,SUSPENDED Default:ACTIVE|ACTIVE| Path Parameters:  | Parameter   |Type   | Mandatory| Description          | Example   | |-------------|-------|----------|----------------------|-----------| |deviceId|string|true|null|| |templateName|string|true|null||   This API requires **PROTECTED_API** permission(s).  

        :param create_alert_by_template_name_request: (required)
        :type create_alert_by_template_name_request: CreateAlertByTemplateNameRequest
        :param device_id: (required)
        :type device_id: str
        :param template_name: (required)
        :type template_name: str
        :param x_execution_mode: X-Execution-Mode — Optional header to control execution mode.  Use sync to make the API wait until all background operations complete before returning a response.  If omitted, the request is processed asynchronously (default). 
        :type x_execution_mode: str
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._create_alert_by_template_name_serialize(
            create_alert_by_template_name_request=create_alert_by_template_name_request,
            device_id=device_id,
            template_name=template_name,
            x_execution_mode=x_execution_mode,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '400': "ErrorResponse",
            '201': "DeviceAlertResponse",
            '500': "ErrorResponse",
            '401': "ErrorResponse",
            '403': "ErrorResponse",
            '404': "ErrorResponse",
            '504': "ErrorResponse",
            '409': "ErrorResponse",
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        return response_data.response


    def _create_alert_by_template_name_serialize(
        self,
        create_alert_by_template_name_request,
        device_id,
        template_name,
        x_execution_mode,
        _request_auth,
        _content_type,
        _headers,
        _host_index,
    ) -> RequestSerialized:

        _host = None

        _collection_formats: Dict[str, str] = {
        }

        _path_params: Dict[str, str] = {}
        _query_params: List[Tuple[str, str]] = []
        _header_params: Dict[str, Optional[str]] = _headers or {}
        _form_params: List[Tuple[str, str]] = []
        _files: Dict[
            str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
        ] = {}
        _body_params: Optional[bytes] = None

        # process the path parameters
        if device_id is not None:
            _path_params['deviceId'] = device_id
        if template_name is not None:
            _path_params['templateName'] = template_name
        # process the query parameters
        # process the header parameters
        if x_execution_mode is not None:
            _header_params['x-execution-mode'] = x_execution_mode
        # process the form parameters
        # process the body parameter
        if create_alert_by_template_name_request is not None:
            _body_params = create_alert_by_template_name_request


        # set the HTTP header `Accept`
        if 'Accept' not in _header_params:
            _header_params['Accept'] = self.api_client.select_header_accept(
                [
                    'application/json'
                ]
            )

        # set the HTTP header `Content-Type`
        if _content_type:
            _header_params['Content-Type'] = _content_type
        else:
            _default_content_type = (
                self.api_client.select_header_content_type(
                    [
                        'application/json'
                    ]
                )
            )
            if _default_content_type is not None:
                _header_params['Content-Type'] = _default_content_type

        # authentication setting
        _auth_settings: List[str] = [
            'bearerAuth'
        ]

        return self.api_client.param_serialize(
            method='POST',
            resource_path='/v1/devices/{deviceId}/alerts/{templateName}',
            path_params=_path_params,
            query_params=_query_params,
            header_params=_header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            auth_settings=_auth_settings,
            collection_formats=_collection_formats,
            _host=_host,
            _request_auth=_request_auth
        )




    @validate_call
    def delete_alert(
        self,
        device_id: StrictStr,
        id: Annotated[UUID, Field(description="Device Alert ID that needs to be deleted")],
        x_execution_mode: Annotated[Optional[StrictStr], Field(description="X-Execution-Mode — Optional header to control execution mode.  Use sync to make the API wait until all background operations complete before returning a response.  If omitted, the request is processed asynchronously (default). ")] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> None:
        """Delete Device Alert

        Delete Device Alert    Path Parameters:  | Parameter   |Type   | Mandatory| Description          | Example   | |-------------|-------|----------|----------------------|-----------| |deviceId|string|true|null|| |id|string|true|Device Alert ID that needs to be deleted|3fa85f64-5717-4562-b3fc-2c963f66afa6|   This API requires **PROTECTED_API** permission(s).  

        :param device_id: (required)
        :type device_id: str
        :param id: Device Alert ID that needs to be deleted (required)
        :type id: UUID
        :param x_execution_mode: X-Execution-Mode — Optional header to control execution mode.  Use sync to make the API wait until all background operations complete before returning a response.  If omitted, the request is processed asynchronously (default). 
        :type x_execution_mode: str
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._delete_alert_serialize(
            device_id=device_id,
            id=id,
            x_execution_mode=x_execution_mode,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '400': "ErrorResponse",
            '204': None,
            '500': "ErrorResponse",
            '401': "ErrorResponse",
            '403': "ErrorResponse",
            '404': "ErrorResponse",
            '504': "ErrorResponse",
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        ).data


    @validate_call
    def delete_alert_with_http_info(
        self,
        device_id: StrictStr,
        id: Annotated[UUID, Field(description="Device Alert ID that needs to be deleted")],
        x_execution_mode: Annotated[Optional[StrictStr], Field(description="X-Execution-Mode — Optional header to control execution mode.  Use sync to make the API wait until all background operations complete before returning a response.  If omitted, the request is processed asynchronously (default). ")] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> ApiResponse[None]:
        """Delete Device Alert

        Delete Device Alert    Path Parameters:  | Parameter   |Type   | Mandatory| Description          | Example   | |-------------|-------|----------|----------------------|-----------| |deviceId|string|true|null|| |id|string|true|Device Alert ID that needs to be deleted|3fa85f64-5717-4562-b3fc-2c963f66afa6|   This API requires **PROTECTED_API** permission(s).  

        :param device_id: (required)
        :type device_id: str
        :param id: Device Alert ID that needs to be deleted (required)
        :type id: UUID
        :param x_execution_mode: X-Execution-Mode — Optional header to control execution mode.  Use sync to make the API wait until all background operations complete before returning a response.  If omitted, the request is processed asynchronously (default). 
        :type x_execution_mode: str
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._delete_alert_serialize(
            device_id=device_id,
            id=id,
            x_execution_mode=x_execution_mode,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '400': "ErrorResponse",
            '204': None,
            '500': "ErrorResponse",
            '401': "ErrorResponse",
            '403': "ErrorResponse",
            '404': "ErrorResponse",
            '504': "ErrorResponse",
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        )


    @validate_call
    def delete_alert_without_preload_content(
        self,
        device_id: StrictStr,
        id: Annotated[UUID, Field(description="Device Alert ID that needs to be deleted")],
        x_execution_mode: Annotated[Optional[StrictStr], Field(description="X-Execution-Mode — Optional header to control execution mode.  Use sync to make the API wait until all background operations complete before returning a response.  If omitted, the request is processed asynchronously (default). ")] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> RESTResponseType:
        """Delete Device Alert

        Delete Device Alert    Path Parameters:  | Parameter   |Type   | Mandatory| Description          | Example   | |-------------|-------|----------|----------------------|-----------| |deviceId|string|true|null|| |id|string|true|Device Alert ID that needs to be deleted|3fa85f64-5717-4562-b3fc-2c963f66afa6|   This API requires **PROTECTED_API** permission(s).  

        :param device_id: (required)
        :type device_id: str
        :param id: Device Alert ID that needs to be deleted (required)
        :type id: UUID
        :param x_execution_mode: X-Execution-Mode — Optional header to control execution mode.  Use sync to make the API wait until all background operations complete before returning a response.  If omitted, the request is processed asynchronously (default). 
        :type x_execution_mode: str
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._delete_alert_serialize(
            device_id=device_id,
            id=id,
            x_execution_mode=x_execution_mode,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '400': "ErrorResponse",
            '204': None,
            '500': "ErrorResponse",
            '401': "ErrorResponse",
            '403': "ErrorResponse",
            '404': "ErrorResponse",
            '504': "ErrorResponse",
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        return response_data.response


    def _delete_alert_serialize(
        self,
        device_id,
        id,
        x_execution_mode,
        _request_auth,
        _content_type,
        _headers,
        _host_index,
    ) -> RequestSerialized:

        _host = None

        _collection_formats: Dict[str, str] = {
        }

        _path_params: Dict[str, str] = {}
        _query_params: List[Tuple[str, str]] = []
        _header_params: Dict[str, Optional[str]] = _headers or {}
        _form_params: List[Tuple[str, str]] = []
        _files: Dict[
            str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
        ] = {}
        _body_params: Optional[bytes] = None

        # process the path parameters
        if device_id is not None:
            _path_params['deviceId'] = device_id
        if id is not None:
            _path_params['id'] = id
        # process the query parameters
        # process the header parameters
        if x_execution_mode is not None:
            _header_params['x-execution-mode'] = x_execution_mode
        # process the form parameters
        # process the body parameter


        # set the HTTP header `Accept`
        if 'Accept' not in _header_params:
            _header_params['Accept'] = self.api_client.select_header_accept(
                [
                    'application/json'
                ]
            )


        # authentication setting
        _auth_settings: List[str] = [
            'bearerAuth'
        ]

        return self.api_client.param_serialize(
            method='DELETE',
            resource_path='/v1/devices/{deviceId}/alerts/{id}',
            path_params=_path_params,
            query_params=_query_params,
            header_params=_header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            auth_settings=_auth_settings,
            collection_formats=_collection_formats,
            _host=_host,
            _request_auth=_request_auth
        )




    @validate_call
    def get_alert(
        self,
        device_id: StrictStr,
        id: Annotated[UUID, Field(description="Device Alert ID that needs to be fetched")],
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> DeviceAlertResponse:
        """Get Device Alert by ID

        Get Device Alert by ID    Path Parameters:  | Parameter   |Type   | Mandatory| Description          | Example   | |-------------|-------|----------|----------------------|-----------| |deviceId|string|true|null|| |id|string|true|Device Alert ID that needs to be fetched|3fa85f64-5717-4562-b3fc-2c963f66afa6|   This API requires **PROTECTED_API** permission(s).  

        :param device_id: (required)
        :type device_id: str
        :param id: Device Alert ID that needs to be fetched (required)
        :type id: UUID
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._get_alert_serialize(
            device_id=device_id,
            id=id,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '400': "ErrorResponse",
            '200': "DeviceAlertResponse",
            '500': "ErrorResponse",
            '401': "ErrorResponse",
            '403': "ErrorResponse",
            '404': "ErrorResponse",
            '504': "ErrorResponse",
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        ).data


    @validate_call
    def get_alert_with_http_info(
        self,
        device_id: StrictStr,
        id: Annotated[UUID, Field(description="Device Alert ID that needs to be fetched")],
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> ApiResponse[DeviceAlertResponse]:
        """Get Device Alert by ID

        Get Device Alert by ID    Path Parameters:  | Parameter   |Type   | Mandatory| Description          | Example   | |-------------|-------|----------|----------------------|-----------| |deviceId|string|true|null|| |id|string|true|Device Alert ID that needs to be fetched|3fa85f64-5717-4562-b3fc-2c963f66afa6|   This API requires **PROTECTED_API** permission(s).  

        :param device_id: (required)
        :type device_id: str
        :param id: Device Alert ID that needs to be fetched (required)
        :type id: UUID
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._get_alert_serialize(
            device_id=device_id,
            id=id,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '400': "ErrorResponse",
            '200': "DeviceAlertResponse",
            '500': "ErrorResponse",
            '401': "ErrorResponse",
            '403': "ErrorResponse",
            '404': "ErrorResponse",
            '504': "ErrorResponse",
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        )


    @validate_call
    def get_alert_without_preload_content(
        self,
        device_id: StrictStr,
        id: Annotated[UUID, Field(description="Device Alert ID that needs to be fetched")],
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> RESTResponseType:
        """Get Device Alert by ID

        Get Device Alert by ID    Path Parameters:  | Parameter   |Type   | Mandatory| Description          | Example   | |-------------|-------|----------|----------------------|-----------| |deviceId|string|true|null|| |id|string|true|Device Alert ID that needs to be fetched|3fa85f64-5717-4562-b3fc-2c963f66afa6|   This API requires **PROTECTED_API** permission(s).  

        :param device_id: (required)
        :type device_id: str
        :param id: Device Alert ID that needs to be fetched (required)
        :type id: UUID
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._get_alert_serialize(
            device_id=device_id,
            id=id,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '400': "ErrorResponse",
            '200': "DeviceAlertResponse",
            '500': "ErrorResponse",
            '401': "ErrorResponse",
            '403': "ErrorResponse",
            '404': "ErrorResponse",
            '504': "ErrorResponse",
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        return response_data.response


    def _get_alert_serialize(
        self,
        device_id,
        id,
        _request_auth,
        _content_type,
        _headers,
        _host_index,
    ) -> RequestSerialized:

        _host = None

        _collection_formats: Dict[str, str] = {
        }

        _path_params: Dict[str, str] = {}
        _query_params: List[Tuple[str, str]] = []
        _header_params: Dict[str, Optional[str]] = _headers or {}
        _form_params: List[Tuple[str, str]] = []
        _files: Dict[
            str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
        ] = {}
        _body_params: Optional[bytes] = None

        # process the path parameters
        if device_id is not None:
            _path_params['deviceId'] = device_id
        if id is not None:
            _path_params['id'] = id
        # process the query parameters
        # process the header parameters
        # process the form parameters
        # process the body parameter


        # set the HTTP header `Accept`
        if 'Accept' not in _header_params:
            _header_params['Accept'] = self.api_client.select_header_accept(
                [
                    'application/json'
                ]
            )


        # authentication setting
        _auth_settings: List[str] = [
            'bearerAuth'
        ]

        return self.api_client.param_serialize(
            method='GET',
            resource_path='/v1/devices/{deviceId}/alerts/{id}',
            path_params=_path_params,
            query_params=_query_params,
            header_params=_header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            auth_settings=_auth_settings,
            collection_formats=_collection_formats,
            _host=_host,
            _request_auth=_request_auth
        )




    @validate_call
    def search_alerts(
        self,
        search_request: Annotated[Optional[SearchRequestV2], Field(description="Search request parameters: filter, sort and page")] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> SearchResponseDeviceAlertResponse:
        """Search Device Alert entities by filter

        Search Device Alert entities by filter  Returns list of Device Alert, the response can be filtered, sorted and supports pagination   **For more information and examples on creating search requests, click <a href=\"https://docs.biot-med.com/docs/using-biot-search-apis\" target=\"_blank\">here.</a>** ## Filter Each additionalProp can filter one field, inside additionalProp there are many optional conditions that can be used for filtering that field  By using the logical additionalProps $AND, $OR, $NOT, you can add complex nested logic filters. When sending these props, you must send only the nested filter field inside the filter value. This will allow you to group additional filters using logical AND/OR/NOT operators. When not sending a logic prop (including when not sending a nested logic prop), the props are bundled together using logical AND operators, this means that only the items that match all filter conditions for that field will be returned.  ***filter*** items possible values: [ *_id*,*_templateId*,*_templateName*,*_device.id*,*_ownerOrganization.id*,*_severity*,*_state*,*_setDateTime*,*_clearDateTime*,*_clearTrigger*,*_clearedBy.id*,*_clearNotes*,*_name*,*_creationTime*,*_lastModifiedTime* ] and all custom attributes of all templates  ## Sort Results can be sorted by multiple fields, the order of the fields in the sort request governs the hierarchy of the sort  The first field is the primary sort, the second is used when two values of the first field are the same, and so forth  ***sort.order*** default value is DESC  ***sort.prop*** possible values:[ *_id*,*_device.id*,*_ownerOrganization.id*,*_severity*,*_state*,*_setDateTime*,*_clearDateTime*,*_clearTrigger*,*_clearedBy.id*,*_clearNotes*,*_name*,*_creationTime*,*_lastModifiedTime* ]  If sort was not specified, the result will be sorted by: *_creationTime* DESC  ## Free text search When freeTextSearch is passed, the free text search will be performed on every field except those of type Date  If used together with filters, freeTextSearch will be bundled to the filters with the logical AND operator, this means that only items that match all filters (and each filter's conditions) and the free text search will be returned  ## Page ***limit*** max number of results that will be returned for each page. If not specify, the default will be 100  ***page*** page number starting from 0. If not specify, the default will be 0  ## Build URL Encode the JSON object and use the encoded string as the searchRequest parameter:  https://&lt;URL&gt;?searchRequest=<ENCODED_JSON_STRING>  Query Parameters:  | Parameter   |Type   | Mandatory| Description          | Example   | |-------------|-------|----------|----------------------|-----------| |searchRequest||false|Search request parameters: filter, sort and page||   This API requires **PROTECTED_API** permission(s).  

        :param search_request: Search request parameters: filter, sort and page
        :type search_request: SearchRequestV2
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._search_alerts_serialize(
            search_request=search_request,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '400': "ErrorResponse",
            '200': "SearchResponseDeviceAlertResponse",
            '500': "ErrorResponse",
            '401': "ErrorResponse",
            '403': "ErrorResponse",
            '504': "ErrorResponse",
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        ).data


    @validate_call
    def search_alerts_with_http_info(
        self,
        search_request: Annotated[Optional[SearchRequestV2], Field(description="Search request parameters: filter, sort and page")] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> ApiResponse[SearchResponseDeviceAlertResponse]:
        """Search Device Alert entities by filter

        Search Device Alert entities by filter  Returns list of Device Alert, the response can be filtered, sorted and supports pagination   **For more information and examples on creating search requests, click <a href=\"https://docs.biot-med.com/docs/using-biot-search-apis\" target=\"_blank\">here.</a>** ## Filter Each additionalProp can filter one field, inside additionalProp there are many optional conditions that can be used for filtering that field  By using the logical additionalProps $AND, $OR, $NOT, you can add complex nested logic filters. When sending these props, you must send only the nested filter field inside the filter value. This will allow you to group additional filters using logical AND/OR/NOT operators. When not sending a logic prop (including when not sending a nested logic prop), the props are bundled together using logical AND operators, this means that only the items that match all filter conditions for that field will be returned.  ***filter*** items possible values: [ *_id*,*_templateId*,*_templateName*,*_device.id*,*_ownerOrganization.id*,*_severity*,*_state*,*_setDateTime*,*_clearDateTime*,*_clearTrigger*,*_clearedBy.id*,*_clearNotes*,*_name*,*_creationTime*,*_lastModifiedTime* ] and all custom attributes of all templates  ## Sort Results can be sorted by multiple fields, the order of the fields in the sort request governs the hierarchy of the sort  The first field is the primary sort, the second is used when two values of the first field are the same, and so forth  ***sort.order*** default value is DESC  ***sort.prop*** possible values:[ *_id*,*_device.id*,*_ownerOrganization.id*,*_severity*,*_state*,*_setDateTime*,*_clearDateTime*,*_clearTrigger*,*_clearedBy.id*,*_clearNotes*,*_name*,*_creationTime*,*_lastModifiedTime* ]  If sort was not specified, the result will be sorted by: *_creationTime* DESC  ## Free text search When freeTextSearch is passed, the free text search will be performed on every field except those of type Date  If used together with filters, freeTextSearch will be bundled to the filters with the logical AND operator, this means that only items that match all filters (and each filter's conditions) and the free text search will be returned  ## Page ***limit*** max number of results that will be returned for each page. If not specify, the default will be 100  ***page*** page number starting from 0. If not specify, the default will be 0  ## Build URL Encode the JSON object and use the encoded string as the searchRequest parameter:  https://&lt;URL&gt;?searchRequest=<ENCODED_JSON_STRING>  Query Parameters:  | Parameter   |Type   | Mandatory| Description          | Example   | |-------------|-------|----------|----------------------|-----------| |searchRequest||false|Search request parameters: filter, sort and page||   This API requires **PROTECTED_API** permission(s).  

        :param search_request: Search request parameters: filter, sort and page
        :type search_request: SearchRequestV2
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._search_alerts_serialize(
            search_request=search_request,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '400': "ErrorResponse",
            '200': "SearchResponseDeviceAlertResponse",
            '500': "ErrorResponse",
            '401': "ErrorResponse",
            '403': "ErrorResponse",
            '504': "ErrorResponse",
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        )


    @validate_call
    def search_alerts_without_preload_content(
        self,
        search_request: Annotated[Optional[SearchRequestV2], Field(description="Search request parameters: filter, sort and page")] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> RESTResponseType:
        """Search Device Alert entities by filter

        Search Device Alert entities by filter  Returns list of Device Alert, the response can be filtered, sorted and supports pagination   **For more information and examples on creating search requests, click <a href=\"https://docs.biot-med.com/docs/using-biot-search-apis\" target=\"_blank\">here.</a>** ## Filter Each additionalProp can filter one field, inside additionalProp there are many optional conditions that can be used for filtering that field  By using the logical additionalProps $AND, $OR, $NOT, you can add complex nested logic filters. When sending these props, you must send only the nested filter field inside the filter value. This will allow you to group additional filters using logical AND/OR/NOT operators. When not sending a logic prop (including when not sending a nested logic prop), the props are bundled together using logical AND operators, this means that only the items that match all filter conditions for that field will be returned.  ***filter*** items possible values: [ *_id*,*_templateId*,*_templateName*,*_device.id*,*_ownerOrganization.id*,*_severity*,*_state*,*_setDateTime*,*_clearDateTime*,*_clearTrigger*,*_clearedBy.id*,*_clearNotes*,*_name*,*_creationTime*,*_lastModifiedTime* ] and all custom attributes of all templates  ## Sort Results can be sorted by multiple fields, the order of the fields in the sort request governs the hierarchy of the sort  The first field is the primary sort, the second is used when two values of the first field are the same, and so forth  ***sort.order*** default value is DESC  ***sort.prop*** possible values:[ *_id*,*_device.id*,*_ownerOrganization.id*,*_severity*,*_state*,*_setDateTime*,*_clearDateTime*,*_clearTrigger*,*_clearedBy.id*,*_clearNotes*,*_name*,*_creationTime*,*_lastModifiedTime* ]  If sort was not specified, the result will be sorted by: *_creationTime* DESC  ## Free text search When freeTextSearch is passed, the free text search will be performed on every field except those of type Date  If used together with filters, freeTextSearch will be bundled to the filters with the logical AND operator, this means that only items that match all filters (and each filter's conditions) and the free text search will be returned  ## Page ***limit*** max number of results that will be returned for each page. If not specify, the default will be 100  ***page*** page number starting from 0. If not specify, the default will be 0  ## Build URL Encode the JSON object and use the encoded string as the searchRequest parameter:  https://&lt;URL&gt;?searchRequest=<ENCODED_JSON_STRING>  Query Parameters:  | Parameter   |Type   | Mandatory| Description          | Example   | |-------------|-------|----------|----------------------|-----------| |searchRequest||false|Search request parameters: filter, sort and page||   This API requires **PROTECTED_API** permission(s).  

        :param search_request: Search request parameters: filter, sort and page
        :type search_request: SearchRequestV2
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._search_alerts_serialize(
            search_request=search_request,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '400': "ErrorResponse",
            '200': "SearchResponseDeviceAlertResponse",
            '500': "ErrorResponse",
            '401': "ErrorResponse",
            '403': "ErrorResponse",
            '504': "ErrorResponse",
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        return response_data.response


    def _search_alerts_serialize(
        self,
        search_request,
        _request_auth,
        _content_type,
        _headers,
        _host_index,
    ) -> RequestSerialized:

        _host = None

        _collection_formats: Dict[str, str] = {
        }

        _path_params: Dict[str, str] = {}
        _query_params: List[Tuple[str, str]] = []
        _header_params: Dict[str, Optional[str]] = _headers or {}
        _form_params: List[Tuple[str, str]] = []
        _files: Dict[
            str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
        ] = {}
        _body_params: Optional[bytes] = None

        # process the path parameters
        # process the query parameters
        if search_request is not None:
            
            _query_params.append(('searchRequest', search_request))
            
        # process the header parameters
        # process the form parameters
        # process the body parameter


        # set the HTTP header `Accept`
        if 'Accept' not in _header_params:
            _header_params['Accept'] = self.api_client.select_header_accept(
                [
                    'application/json'
                ]
            )


        # authentication setting
        _auth_settings: List[str] = [
            'bearerAuth'
        ]

        return self.api_client.param_serialize(
            method='GET',
            resource_path='/v1/devices/alerts',
            path_params=_path_params,
            query_params=_query_params,
            header_params=_header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            auth_settings=_auth_settings,
            collection_formats=_collection_formats,
            _host=_host,
            _request_auth=_request_auth
        )




    @validate_call
    def search_current_alerts(
        self,
        search_request: Annotated[Optional[SearchRequestV2], Field(description="Search request parameters: filter, sort and page")] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> SearchResponseDeviceOwnedAlertResponse:
        """Search open device's alerts entities by filter

        Search open device's alerts entities by filter  Returns list of open device's alerts, the response can be filtered, sorted and supports pagination   **For more information and examples on creating search requests, click <a href=\"https://docs.biot-med.com/docs/using-biot-search-apis\" target=\"_blank\">here.</a>** ## Filter Each additionalProp can filter one field, inside additionalProp there are many optional conditions that can be used for filtering that field  By using the logical additionalProps $AND, $OR, $NOT, you can add complex nested logic filters. When sending these props, you must send only the nested filter field inside the filter value. This will allow you to group additional filters using logical AND/OR/NOT operators. When not sending a logic prop (including when not sending a nested logic prop), the props are bundled together using logical AND operators, this means that only the items that match all filter conditions for that field will be returned.  ***filter*** items possible values: [ *_ownerOrganization.id* ]   ## Sort Results can be sorted by multiple fields, the order of the fields in the sort request governs the hierarchy of the sort  The first field is the primary sort, the second is used when two values of the first field are the same, and so forth  ***sort.order*** default value is DESC  ***sort.prop*** possible values:[  ]  If sort was not specified, the result will be sorted by: creationTime DESC  ## Free text search When freeTextSearch is passed, the free text search will be performed on every field except those of type Date  If used together with filters, freeTextSearch will be bundled to the filters with the logical AND operator, this means that only items that match all filters (and each filter's conditions) and the free text search will be returned  ## Page ***limit*** max number of results that will be returned for each page. If not specify, the default will be 100  ***page*** page number starting from 0. If not specify, the default will be 0  ## Build URL Encode the JSON object and use the encoded string as the searchRequest parameter:  https://&lt;URL&gt;?searchRequest=<ENCODED_JSON_STRING>  Query Parameters:  | Parameter   |Type   | Mandatory| Description          | Example   | |-------------|-------|----------|----------------------|-----------| |searchRequest||false|Search request parameters: filter, sort and page||   This API requires **PROTECTED_API** permission(s).  

        :param search_request: Search request parameters: filter, sort and page
        :type search_request: SearchRequestV2
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._search_current_alerts_serialize(
            search_request=search_request,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '400': "ErrorResponse",
            '200': "SearchResponseDeviceOwnedAlertResponse",
            '500': "ErrorResponse",
            '401': "ErrorResponse",
            '403': "ErrorResponse",
            '504': "ErrorResponse",
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        ).data


    @validate_call
    def search_current_alerts_with_http_info(
        self,
        search_request: Annotated[Optional[SearchRequestV2], Field(description="Search request parameters: filter, sort and page")] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> ApiResponse[SearchResponseDeviceOwnedAlertResponse]:
        """Search open device's alerts entities by filter

        Search open device's alerts entities by filter  Returns list of open device's alerts, the response can be filtered, sorted and supports pagination   **For more information and examples on creating search requests, click <a href=\"https://docs.biot-med.com/docs/using-biot-search-apis\" target=\"_blank\">here.</a>** ## Filter Each additionalProp can filter one field, inside additionalProp there are many optional conditions that can be used for filtering that field  By using the logical additionalProps $AND, $OR, $NOT, you can add complex nested logic filters. When sending these props, you must send only the nested filter field inside the filter value. This will allow you to group additional filters using logical AND/OR/NOT operators. When not sending a logic prop (including when not sending a nested logic prop), the props are bundled together using logical AND operators, this means that only the items that match all filter conditions for that field will be returned.  ***filter*** items possible values: [ *_ownerOrganization.id* ]   ## Sort Results can be sorted by multiple fields, the order of the fields in the sort request governs the hierarchy of the sort  The first field is the primary sort, the second is used when two values of the first field are the same, and so forth  ***sort.order*** default value is DESC  ***sort.prop*** possible values:[  ]  If sort was not specified, the result will be sorted by: creationTime DESC  ## Free text search When freeTextSearch is passed, the free text search will be performed on every field except those of type Date  If used together with filters, freeTextSearch will be bundled to the filters with the logical AND operator, this means that only items that match all filters (and each filter's conditions) and the free text search will be returned  ## Page ***limit*** max number of results that will be returned for each page. If not specify, the default will be 100  ***page*** page number starting from 0. If not specify, the default will be 0  ## Build URL Encode the JSON object and use the encoded string as the searchRequest parameter:  https://&lt;URL&gt;?searchRequest=<ENCODED_JSON_STRING>  Query Parameters:  | Parameter   |Type   | Mandatory| Description          | Example   | |-------------|-------|----------|----------------------|-----------| |searchRequest||false|Search request parameters: filter, sort and page||   This API requires **PROTECTED_API** permission(s).  

        :param search_request: Search request parameters: filter, sort and page
        :type search_request: SearchRequestV2
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._search_current_alerts_serialize(
            search_request=search_request,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '400': "ErrorResponse",
            '200': "SearchResponseDeviceOwnedAlertResponse",
            '500': "ErrorResponse",
            '401': "ErrorResponse",
            '403': "ErrorResponse",
            '504': "ErrorResponse",
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        )


    @validate_call
    def search_current_alerts_without_preload_content(
        self,
        search_request: Annotated[Optional[SearchRequestV2], Field(description="Search request parameters: filter, sort and page")] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> RESTResponseType:
        """Search open device's alerts entities by filter

        Search open device's alerts entities by filter  Returns list of open device's alerts, the response can be filtered, sorted and supports pagination   **For more information and examples on creating search requests, click <a href=\"https://docs.biot-med.com/docs/using-biot-search-apis\" target=\"_blank\">here.</a>** ## Filter Each additionalProp can filter one field, inside additionalProp there are many optional conditions that can be used for filtering that field  By using the logical additionalProps $AND, $OR, $NOT, you can add complex nested logic filters. When sending these props, you must send only the nested filter field inside the filter value. This will allow you to group additional filters using logical AND/OR/NOT operators. When not sending a logic prop (including when not sending a nested logic prop), the props are bundled together using logical AND operators, this means that only the items that match all filter conditions for that field will be returned.  ***filter*** items possible values: [ *_ownerOrganization.id* ]   ## Sort Results can be sorted by multiple fields, the order of the fields in the sort request governs the hierarchy of the sort  The first field is the primary sort, the second is used when two values of the first field are the same, and so forth  ***sort.order*** default value is DESC  ***sort.prop*** possible values:[  ]  If sort was not specified, the result will be sorted by: creationTime DESC  ## Free text search When freeTextSearch is passed, the free text search will be performed on every field except those of type Date  If used together with filters, freeTextSearch will be bundled to the filters with the logical AND operator, this means that only items that match all filters (and each filter's conditions) and the free text search will be returned  ## Page ***limit*** max number of results that will be returned for each page. If not specify, the default will be 100  ***page*** page number starting from 0. If not specify, the default will be 0  ## Build URL Encode the JSON object and use the encoded string as the searchRequest parameter:  https://&lt;URL&gt;?searchRequest=<ENCODED_JSON_STRING>  Query Parameters:  | Parameter   |Type   | Mandatory| Description          | Example   | |-------------|-------|----------|----------------------|-----------| |searchRequest||false|Search request parameters: filter, sort and page||   This API requires **PROTECTED_API** permission(s).  

        :param search_request: Search request parameters: filter, sort and page
        :type search_request: SearchRequestV2
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._search_current_alerts_serialize(
            search_request=search_request,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '400': "ErrorResponse",
            '200': "SearchResponseDeviceOwnedAlertResponse",
            '500': "ErrorResponse",
            '401': "ErrorResponse",
            '403': "ErrorResponse",
            '504': "ErrorResponse",
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        return response_data.response


    def _search_current_alerts_serialize(
        self,
        search_request,
        _request_auth,
        _content_type,
        _headers,
        _host_index,
    ) -> RequestSerialized:

        _host = None

        _collection_formats: Dict[str, str] = {
        }

        _path_params: Dict[str, str] = {}
        _query_params: List[Tuple[str, str]] = []
        _header_params: Dict[str, Optional[str]] = _headers or {}
        _form_params: List[Tuple[str, str]] = []
        _files: Dict[
            str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
        ] = {}
        _body_params: Optional[bytes] = None

        # process the path parameters
        # process the query parameters
        if search_request is not None:
            
            _query_params.append(('searchRequest', search_request))
            
        # process the header parameters
        # process the form parameters
        # process the body parameter


        # set the HTTP header `Accept`
        if 'Accept' not in _header_params:
            _header_params['Accept'] = self.api_client.select_header_accept(
                [
                    'application/json'
                ]
            )


        # authentication setting
        _auth_settings: List[str] = [
            'bearerAuth'
        ]

        return self.api_client.param_serialize(
            method='GET',
            resource_path='/v1/devices/current/alerts',
            path_params=_path_params,
            query_params=_query_params,
            header_params=_header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            auth_settings=_auth_settings,
            collection_formats=_collection_formats,
            _host=_host,
            _request_auth=_request_auth
        )




    @validate_call
    def update_alert(
        self,
        update_alert_request: UpdateAlertRequest,
        device_id: StrictStr,
        id: Annotated[UUID, Field(description="Device Alert ID that needs to be updated")],
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> DeviceAlertResponse:
        """Update Device Alert

        Update Device Alert  Performs partial update, if a field is specified in the request it will be updated  Request Body Parameters:  | Parameter   |Type   | Mandatory| Description          | Example   | |-------------|-------|----------|----------------------|-----------| |&lt;customAttribute1&gt;|&lt;customAttribute1Type&gt;|false|Regular custom attribute 1 value|| |&lt;customAttributeN&gt;|&lt;customAttributeNType&gt;|false|Regular custom attribute N value|| |_clearNotes|string|false|Clear notes|| |_name|string|false|The name of the alert|| |_severity|string|false|The alert wanted severity Values:CRITICAL,MAJOR,MINOR,INFO|MAJOR| |_state|string|false|The alert wanted state Values:ACTIVE,CLEARED,SUSPENDED|ACTIVE| Path Parameters:  | Parameter   |Type   | Mandatory| Description          | Example   | |-------------|-------|----------|----------------------|-----------| |deviceId|string|true|null|| |id|string|true|Device Alert ID that needs to be updated|3fa85f64-5717-4562-b3fc-2c963f66afa6|   This API requires **PROTECTED_API** permission(s).  

        :param update_alert_request: (required)
        :type update_alert_request: UpdateAlertRequest
        :param device_id: (required)
        :type device_id: str
        :param id: Device Alert ID that needs to be updated (required)
        :type id: UUID
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._update_alert_serialize(
            update_alert_request=update_alert_request,
            device_id=device_id,
            id=id,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '400': "ErrorResponse",
            '200': "DeviceAlertResponse",
            '500': "ErrorResponse",
            '401': "ErrorResponse",
            '403': "ErrorResponse",
            '404': "ErrorResponse",
            '504': "ErrorResponse",
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        ).data


    @validate_call
    def update_alert_with_http_info(
        self,
        update_alert_request: UpdateAlertRequest,
        device_id: StrictStr,
        id: Annotated[UUID, Field(description="Device Alert ID that needs to be updated")],
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> ApiResponse[DeviceAlertResponse]:
        """Update Device Alert

        Update Device Alert  Performs partial update, if a field is specified in the request it will be updated  Request Body Parameters:  | Parameter   |Type   | Mandatory| Description          | Example   | |-------------|-------|----------|----------------------|-----------| |&lt;customAttribute1&gt;|&lt;customAttribute1Type&gt;|false|Regular custom attribute 1 value|| |&lt;customAttributeN&gt;|&lt;customAttributeNType&gt;|false|Regular custom attribute N value|| |_clearNotes|string|false|Clear notes|| |_name|string|false|The name of the alert|| |_severity|string|false|The alert wanted severity Values:CRITICAL,MAJOR,MINOR,INFO|MAJOR| |_state|string|false|The alert wanted state Values:ACTIVE,CLEARED,SUSPENDED|ACTIVE| Path Parameters:  | Parameter   |Type   | Mandatory| Description          | Example   | |-------------|-------|----------|----------------------|-----------| |deviceId|string|true|null|| |id|string|true|Device Alert ID that needs to be updated|3fa85f64-5717-4562-b3fc-2c963f66afa6|   This API requires **PROTECTED_API** permission(s).  

        :param update_alert_request: (required)
        :type update_alert_request: UpdateAlertRequest
        :param device_id: (required)
        :type device_id: str
        :param id: Device Alert ID that needs to be updated (required)
        :type id: UUID
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._update_alert_serialize(
            update_alert_request=update_alert_request,
            device_id=device_id,
            id=id,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '400': "ErrorResponse",
            '200': "DeviceAlertResponse",
            '500': "ErrorResponse",
            '401': "ErrorResponse",
            '403': "ErrorResponse",
            '404': "ErrorResponse",
            '504': "ErrorResponse",
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        )


    @validate_call
    def update_alert_without_preload_content(
        self,
        update_alert_request: UpdateAlertRequest,
        device_id: StrictStr,
        id: Annotated[UUID, Field(description="Device Alert ID that needs to be updated")],
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> RESTResponseType:
        """Update Device Alert

        Update Device Alert  Performs partial update, if a field is specified in the request it will be updated  Request Body Parameters:  | Parameter   |Type   | Mandatory| Description          | Example   | |-------------|-------|----------|----------------------|-----------| |&lt;customAttribute1&gt;|&lt;customAttribute1Type&gt;|false|Regular custom attribute 1 value|| |&lt;customAttributeN&gt;|&lt;customAttributeNType&gt;|false|Regular custom attribute N value|| |_clearNotes|string|false|Clear notes|| |_name|string|false|The name of the alert|| |_severity|string|false|The alert wanted severity Values:CRITICAL,MAJOR,MINOR,INFO|MAJOR| |_state|string|false|The alert wanted state Values:ACTIVE,CLEARED,SUSPENDED|ACTIVE| Path Parameters:  | Parameter   |Type   | Mandatory| Description          | Example   | |-------------|-------|----------|----------------------|-----------| |deviceId|string|true|null|| |id|string|true|Device Alert ID that needs to be updated|3fa85f64-5717-4562-b3fc-2c963f66afa6|   This API requires **PROTECTED_API** permission(s).  

        :param update_alert_request: (required)
        :type update_alert_request: UpdateAlertRequest
        :param device_id: (required)
        :type device_id: str
        :param id: Device Alert ID that needs to be updated (required)
        :type id: UUID
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._update_alert_serialize(
            update_alert_request=update_alert_request,
            device_id=device_id,
            id=id,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '400': "ErrorResponse",
            '200': "DeviceAlertResponse",
            '500': "ErrorResponse",
            '401': "ErrorResponse",
            '403': "ErrorResponse",
            '404': "ErrorResponse",
            '504': "ErrorResponse",
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        return response_data.response


    def _update_alert_serialize(
        self,
        update_alert_request,
        device_id,
        id,
        _request_auth,
        _content_type,
        _headers,
        _host_index,
    ) -> RequestSerialized:

        _host = None

        _collection_formats: Dict[str, str] = {
        }

        _path_params: Dict[str, str] = {}
        _query_params: List[Tuple[str, str]] = []
        _header_params: Dict[str, Optional[str]] = _headers or {}
        _form_params: List[Tuple[str, str]] = []
        _files: Dict[
            str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
        ] = {}
        _body_params: Optional[bytes] = None

        # process the path parameters
        if device_id is not None:
            _path_params['deviceId'] = device_id
        if id is not None:
            _path_params['id'] = id
        # process the query parameters
        # process the header parameters
        # process the form parameters
        # process the body parameter
        if update_alert_request is not None:
            _body_params = update_alert_request


        # set the HTTP header `Accept`
        if 'Accept' not in _header_params:
            _header_params['Accept'] = self.api_client.select_header_accept(
                [
                    'application/json'
                ]
            )

        # set the HTTP header `Content-Type`
        if _content_type:
            _header_params['Content-Type'] = _content_type
        else:
            _default_content_type = (
                self.api_client.select_header_content_type(
                    [
                        'application/json'
                    ]
                )
            )
            if _default_content_type is not None:
                _header_params['Content-Type'] = _default_content_type

        # authentication setting
        _auth_settings: List[str] = [
            'bearerAuth'
        ]

        return self.api_client.param_serialize(
            method='PATCH',
            resource_path='/v1/devices/{deviceId}/alerts/{id}',
            path_params=_path_params,
            query_params=_query_params,
            header_params=_header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            auth_settings=_auth_settings,
            collection_formats=_collection_formats,
            _host=_host,
            _request_auth=_request_auth
        )


