# coding: utf-8

"""
    Mentortools Notifications Server

    Mentortools service for Notifications

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

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


import re  # noqa: F401
import io
import warnings

from pydantic import validate_arguments, ValidationError
from typing import overload, Optional, Union, Awaitable

from pydantic import StrictBool, StrictInt, StrictStr

from typing import Optional

from notifications_server_connector.models.mark_notifications_as_read_internal_request import MarkNotificationsAsReadInternalRequest
from notifications_server_connector.models.mark_notifications_as_read_request import MarkNotificationsAsReadRequest
from notifications_server_connector.models.send_notification_request import SendNotificationRequest
from notifications_server_connector.models.wrapped_response_bool import WrappedResponseBool
from notifications_server_connector.models.wrapped_response_int import WrappedResponseInt
from notifications_server_connector.models.wrapped_response_list_expanded_notification_response import WrappedResponseListExpandedNotificationResponse
from notifications_server_connector.models.wrapped_response_list_int import WrappedResponseListInt

from notifications_server_connector.api_client import ApiClient
from notifications_server_connector.api_response import ApiResponse
from notifications_server_connector.exceptions import (  # noqa: F401
    ApiTypeError,
    ApiValueError
)


class NotificationsApi:
    """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_arguments
    async def notifications_get_user_notification_count(self, is_read : Optional[StrictBool] = None, token : Optional[StrictStr] = None, **kwargs) -> WrappedResponseInt:  # noqa: E501
        """Get user notification count  # noqa: E501

        Get count of notifications for the authenticated user.  # noqa: E501

        :param is_read:
        :type is_read: bool
        :param token:
        :type token: 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.
        :return: Returns the result object.
                 If the method is called asynchronously,
                 returns the request thread.
        :rtype: WrappedResponseInt
        """
        kwargs['_return_http_data_only'] = True
        if '_preload_content' in kwargs:
            message = "Error! Please call the notifications_get_user_notification_count_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data"  # noqa: E501
            raise ValueError(message)
        return await self.notifications_get_user_notification_count_with_http_info(is_read, token, **kwargs)  # noqa: E501

    @validate_arguments
    async def notifications_get_user_notification_count_with_http_info(self, is_read : Optional[StrictBool] = None, token : Optional[StrictStr] = None, **kwargs) -> ApiResponse:  # noqa: E501
        """Get user notification count  # noqa: E501

        Get count of notifications for the authenticated user.  # noqa: E501

        :param is_read:
        :type is_read: bool
        :param token:
        :type token: str
        :param _preload_content: if False, the ApiResponse.data will
                                 be set to none and raw_data will store the
                                 HTTP response body without reading/decoding.
                                 Default is True.
        :type _preload_content: bool, optional
        :param _return_http_data_only: response data instead of ApiResponse
                                       object with status code, headers, etc
        :type _return_http_data_only: bool, optional
        :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.
        :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
        :type _content_type: string, optional: force content-type for the request
        :return: Returns the result object.
                 If the method is called asynchronously,
                 returns the request thread.
        :rtype: tuple(WrappedResponseInt, status_code(int), headers(HTTPHeaderDict))
        """

        _params = locals()

        _all_params = [
            'is_read',
            'token'
        ]
        _all_params.extend(
            [
                '_return_http_data_only',
                '_preload_content',
                '_request_timeout',
                '_request_auth',
                '_content_type',
                '_headers'
            ]
        )

        # validate the arguments
        for _key, _val in _params['kwargs'].items():
            if _key not in _all_params:
                raise ApiTypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method notifications_get_user_notification_count" % _key
                )
            _params[_key] = _val
        del _params['kwargs']

        _collection_formats = {}

        # process the path parameters
        _path_params = {}

        # process the query parameters
        _query_params = []
        if _params.get('is_read') is not None:  # noqa: E501
            _query_params.append(('is_read', _params['is_read']))

        if _params.get('token') is not None:  # noqa: E501
            _query_params.append(('token', _params['token']))

        # process the header parameters
        _header_params = dict(_params.get('_headers', {}))
        # process the form parameters
        _form_params = []
        _files = {}
        # process the body parameter
        _body_params = None
        # set the HTTP header `Accept`
        _header_params['Accept'] = self.api_client.select_header_accept(
            ['application/json'])  # noqa: E501

        # authentication setting
        _auth_settings = ['APIKeyHeader', 'HTTPBearer']  # noqa: E501

        _response_types_map = {
            '200': "WrappedResponseInt",
            '422': "HTTPValidationError",
        }

        return await self.api_client.call_api(
            '/v1/user_notifications/count', 'GET',
            _path_params,
            _query_params,
            _header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            response_types_map=_response_types_map,
            auth_settings=_auth_settings,
            _return_http_data_only=_params.get('_return_http_data_only'),  # noqa: E501
            _preload_content=_params.get('_preload_content', True),
            _request_timeout=_params.get('_request_timeout'),
            collection_formats=_collection_formats,
            _request_auth=_params.get('_request_auth'))

    @validate_arguments
    async def notifications_get_user_notifications(self, offset : Optional[StrictInt] = None, limit : Optional[StrictInt] = None, is_read : Optional[StrictBool] = None, token : Optional[StrictStr] = None, **kwargs) -> WrappedResponseListExpandedNotificationResponse:  # noqa: E501
        """Get user notifications  # noqa: E501

        Get list of notifications for the authenticated user.  # noqa: E501

        :param offset:
        :type offset: int
        :param limit:
        :type limit: int
        :param is_read:
        :type is_read: bool
        :param token:
        :type token: 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.
        :return: Returns the result object.
                 If the method is called asynchronously,
                 returns the request thread.
        :rtype: WrappedResponseListExpandedNotificationResponse
        """
        kwargs['_return_http_data_only'] = True
        if '_preload_content' in kwargs:
            message = "Error! Please call the notifications_get_user_notifications_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data"  # noqa: E501
            raise ValueError(message)
        return await self.notifications_get_user_notifications_with_http_info(offset, limit, is_read, token, **kwargs)  # noqa: E501

    @validate_arguments
    async def notifications_get_user_notifications_with_http_info(self, offset : Optional[StrictInt] = None, limit : Optional[StrictInt] = None, is_read : Optional[StrictBool] = None, token : Optional[StrictStr] = None, **kwargs) -> ApiResponse:  # noqa: E501
        """Get user notifications  # noqa: E501

        Get list of notifications for the authenticated user.  # noqa: E501

        :param offset:
        :type offset: int
        :param limit:
        :type limit: int
        :param is_read:
        :type is_read: bool
        :param token:
        :type token: str
        :param _preload_content: if False, the ApiResponse.data will
                                 be set to none and raw_data will store the
                                 HTTP response body without reading/decoding.
                                 Default is True.
        :type _preload_content: bool, optional
        :param _return_http_data_only: response data instead of ApiResponse
                                       object with status code, headers, etc
        :type _return_http_data_only: bool, optional
        :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.
        :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
        :type _content_type: string, optional: force content-type for the request
        :return: Returns the result object.
                 If the method is called asynchronously,
                 returns the request thread.
        :rtype: tuple(WrappedResponseListExpandedNotificationResponse, status_code(int), headers(HTTPHeaderDict))
        """

        _params = locals()

        _all_params = [
            'offset',
            'limit',
            'is_read',
            'token'
        ]
        _all_params.extend(
            [
                '_return_http_data_only',
                '_preload_content',
                '_request_timeout',
                '_request_auth',
                '_content_type',
                '_headers'
            ]
        )

        # validate the arguments
        for _key, _val in _params['kwargs'].items():
            if _key not in _all_params:
                raise ApiTypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method notifications_get_user_notifications" % _key
                )
            _params[_key] = _val
        del _params['kwargs']

        _collection_formats = {}

        # process the path parameters
        _path_params = {}

        # process the query parameters
        _query_params = []
        if _params.get('offset') is not None:  # noqa: E501
            _query_params.append(('offset', _params['offset']))

        if _params.get('limit') is not None:  # noqa: E501
            _query_params.append(('limit', _params['limit']))

        if _params.get('is_read') is not None:  # noqa: E501
            _query_params.append(('is_read', _params['is_read']))

        if _params.get('token') is not None:  # noqa: E501
            _query_params.append(('token', _params['token']))

        # process the header parameters
        _header_params = dict(_params.get('_headers', {}))
        # process the form parameters
        _form_params = []
        _files = {}
        # process the body parameter
        _body_params = None
        # set the HTTP header `Accept`
        _header_params['Accept'] = self.api_client.select_header_accept(
            ['application/json'])  # noqa: E501

        # authentication setting
        _auth_settings = ['APIKeyHeader', 'HTTPBearer']  # noqa: E501

        _response_types_map = {
            '200': "WrappedResponseListExpandedNotificationResponse",
            '422': "HTTPValidationError",
        }

        return await self.api_client.call_api(
            '/v1/user_notifications/get', 'GET',
            _path_params,
            _query_params,
            _header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            response_types_map=_response_types_map,
            auth_settings=_auth_settings,
            _return_http_data_only=_params.get('_return_http_data_only'),  # noqa: E501
            _preload_content=_params.get('_preload_content', True),
            _request_timeout=_params.get('_request_timeout'),
            collection_formats=_collection_formats,
            _request_auth=_params.get('_request_auth'))

    @validate_arguments
    async def notifications_mark_notifications_as_read(self, mark_notifications_as_read_request : MarkNotificationsAsReadRequest, token : Optional[StrictStr] = None, **kwargs) -> WrappedResponseBool:  # noqa: E501
        """Mark notifications as read  # noqa: E501

        Mark notifications as read for the authenticated user.  # noqa: E501

        :param mark_notifications_as_read_request: (required)
        :type mark_notifications_as_read_request: MarkNotificationsAsReadRequest
        :param token:
        :type token: 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.
        :return: Returns the result object.
                 If the method is called asynchronously,
                 returns the request thread.
        :rtype: WrappedResponseBool
        """
        kwargs['_return_http_data_only'] = True
        if '_preload_content' in kwargs:
            message = "Error! Please call the notifications_mark_notifications_as_read_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data"  # noqa: E501
            raise ValueError(message)
        return await self.notifications_mark_notifications_as_read_with_http_info(mark_notifications_as_read_request, token, **kwargs)  # noqa: E501

    @validate_arguments
    async def notifications_mark_notifications_as_read_with_http_info(self, mark_notifications_as_read_request : MarkNotificationsAsReadRequest, token : Optional[StrictStr] = None, **kwargs) -> ApiResponse:  # noqa: E501
        """Mark notifications as read  # noqa: E501

        Mark notifications as read for the authenticated user.  # noqa: E501

        :param mark_notifications_as_read_request: (required)
        :type mark_notifications_as_read_request: MarkNotificationsAsReadRequest
        :param token:
        :type token: str
        :param _preload_content: if False, the ApiResponse.data will
                                 be set to none and raw_data will store the
                                 HTTP response body without reading/decoding.
                                 Default is True.
        :type _preload_content: bool, optional
        :param _return_http_data_only: response data instead of ApiResponse
                                       object with status code, headers, etc
        :type _return_http_data_only: bool, optional
        :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.
        :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
        :type _content_type: string, optional: force content-type for the request
        :return: Returns the result object.
                 If the method is called asynchronously,
                 returns the request thread.
        :rtype: tuple(WrappedResponseBool, status_code(int), headers(HTTPHeaderDict))
        """

        _params = locals()

        _all_params = [
            'mark_notifications_as_read_request',
            'token'
        ]
        _all_params.extend(
            [
                '_return_http_data_only',
                '_preload_content',
                '_request_timeout',
                '_request_auth',
                '_content_type',
                '_headers'
            ]
        )

        # validate the arguments
        for _key, _val in _params['kwargs'].items():
            if _key not in _all_params:
                raise ApiTypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method notifications_mark_notifications_as_read" % _key
                )
            _params[_key] = _val
        del _params['kwargs']

        _collection_formats = {}

        # process the path parameters
        _path_params = {}

        # process the query parameters
        _query_params = []
        if _params.get('token') is not None:  # noqa: E501
            _query_params.append(('token', _params['token']))

        # process the header parameters
        _header_params = dict(_params.get('_headers', {}))
        # process the form parameters
        _form_params = []
        _files = {}
        # process the body parameter
        _body_params = None
        if _params['mark_notifications_as_read_request'] is not None:
            _body_params = _params['mark_notifications_as_read_request']

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

        # set the HTTP header `Content-Type`
        _content_types_list = _params.get('_content_type',
            self.api_client.select_header_content_type(
                ['application/json']))
        if _content_types_list:
                _header_params['Content-Type'] = _content_types_list

        # authentication setting
        _auth_settings = ['APIKeyHeader', 'HTTPBearer']  # noqa: E501

        _response_types_map = {
            '200': "WrappedResponseBool",
            '422': "HTTPValidationError",
        }

        return await self.api_client.call_api(
            '/v1/mark_notifications_as_read', 'POST',
            _path_params,
            _query_params,
            _header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            response_types_map=_response_types_map,
            auth_settings=_auth_settings,
            _return_http_data_only=_params.get('_return_http_data_only'),  # noqa: E501
            _preload_content=_params.get('_preload_content', True),
            _request_timeout=_params.get('_request_timeout'),
            collection_formats=_collection_formats,
            _request_auth=_params.get('_request_auth'))

    @validate_arguments
    async def notifications_mark_notifications_as_read_internal(self, mark_notifications_as_read_internal_request : MarkNotificationsAsReadInternalRequest, **kwargs) -> WrappedResponseListInt:  # noqa: E501
        """Mark notifications as read (internal)  # noqa: E501

        Mark notifications as read by source. Server-to-server endpoint.  # noqa: E501

        :param mark_notifications_as_read_internal_request: (required)
        :type mark_notifications_as_read_internal_request: MarkNotificationsAsReadInternalRequest
        :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.
        :return: Returns the result object.
                 If the method is called asynchronously,
                 returns the request thread.
        :rtype: WrappedResponseListInt
        """
        kwargs['_return_http_data_only'] = True
        if '_preload_content' in kwargs:
            message = "Error! Please call the notifications_mark_notifications_as_read_internal_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data"  # noqa: E501
            raise ValueError(message)
        return await self.notifications_mark_notifications_as_read_internal_with_http_info(mark_notifications_as_read_internal_request, **kwargs)  # noqa: E501

    @validate_arguments
    async def notifications_mark_notifications_as_read_internal_with_http_info(self, mark_notifications_as_read_internal_request : MarkNotificationsAsReadInternalRequest, **kwargs) -> ApiResponse:  # noqa: E501
        """Mark notifications as read (internal)  # noqa: E501

        Mark notifications as read by source. Server-to-server endpoint.  # noqa: E501

        :param mark_notifications_as_read_internal_request: (required)
        :type mark_notifications_as_read_internal_request: MarkNotificationsAsReadInternalRequest
        :param _preload_content: if False, the ApiResponse.data will
                                 be set to none and raw_data will store the
                                 HTTP response body without reading/decoding.
                                 Default is True.
        :type _preload_content: bool, optional
        :param _return_http_data_only: response data instead of ApiResponse
                                       object with status code, headers, etc
        :type _return_http_data_only: bool, optional
        :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.
        :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
        :type _content_type: string, optional: force content-type for the request
        :return: Returns the result object.
                 If the method is called asynchronously,
                 returns the request thread.
        :rtype: tuple(WrappedResponseListInt, status_code(int), headers(HTTPHeaderDict))
        """

        _params = locals()

        _all_params = [
            'mark_notifications_as_read_internal_request'
        ]
        _all_params.extend(
            [
                '_return_http_data_only',
                '_preload_content',
                '_request_timeout',
                '_request_auth',
                '_content_type',
                '_headers'
            ]
        )

        # validate the arguments
        for _key, _val in _params['kwargs'].items():
            if _key not in _all_params:
                raise ApiTypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method notifications_mark_notifications_as_read_internal" % _key
                )
            _params[_key] = _val
        del _params['kwargs']

        _collection_formats = {}

        # process the path parameters
        _path_params = {}

        # process the query parameters
        _query_params = []
        # process the header parameters
        _header_params = dict(_params.get('_headers', {}))
        # process the form parameters
        _form_params = []
        _files = {}
        # process the body parameter
        _body_params = None
        if _params['mark_notifications_as_read_internal_request'] is not None:
            _body_params = _params['mark_notifications_as_read_internal_request']

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

        # set the HTTP header `Content-Type`
        _content_types_list = _params.get('_content_type',
            self.api_client.select_header_content_type(
                ['application/json']))
        if _content_types_list:
                _header_params['Content-Type'] = _content_types_list

        # authentication setting
        _auth_settings = ['APIKeyHeader']  # noqa: E501

        _response_types_map = {
            '200': "WrappedResponseListInt",
            '422': "HTTPValidationError",
        }

        return await self.api_client.call_api(
            '/v1/mark_notifications_as_read_internal', 'POST',
            _path_params,
            _query_params,
            _header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            response_types_map=_response_types_map,
            auth_settings=_auth_settings,
            _return_http_data_only=_params.get('_return_http_data_only'),  # noqa: E501
            _preload_content=_params.get('_preload_content', True),
            _request_timeout=_params.get('_request_timeout'),
            collection_formats=_collection_formats,
            _request_auth=_params.get('_request_auth'))

    @validate_arguments
    async def notifications_send_notification(self, send_notification_request : SendNotificationRequest, **kwargs) -> WrappedResponseBool:  # noqa: E501
        """Send notification  # noqa: E501

        Send a new notification. Server-to-server endpoint.  # noqa: E501

        :param send_notification_request: (required)
        :type send_notification_request: SendNotificationRequest
        :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.
        :return: Returns the result object.
                 If the method is called asynchronously,
                 returns the request thread.
        :rtype: WrappedResponseBool
        """
        kwargs['_return_http_data_only'] = True
        if '_preload_content' in kwargs:
            message = "Error! Please call the notifications_send_notification_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data"  # noqa: E501
            raise ValueError(message)
        return await self.notifications_send_notification_with_http_info(send_notification_request, **kwargs)  # noqa: E501

    @validate_arguments
    async def notifications_send_notification_with_http_info(self, send_notification_request : SendNotificationRequest, **kwargs) -> ApiResponse:  # noqa: E501
        """Send notification  # noqa: E501

        Send a new notification. Server-to-server endpoint.  # noqa: E501

        :param send_notification_request: (required)
        :type send_notification_request: SendNotificationRequest
        :param _preload_content: if False, the ApiResponse.data will
                                 be set to none and raw_data will store the
                                 HTTP response body without reading/decoding.
                                 Default is True.
        :type _preload_content: bool, optional
        :param _return_http_data_only: response data instead of ApiResponse
                                       object with status code, headers, etc
        :type _return_http_data_only: bool, optional
        :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.
        :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
        :type _content_type: string, optional: force content-type for the request
        :return: Returns the result object.
                 If the method is called asynchronously,
                 returns the request thread.
        :rtype: tuple(WrappedResponseBool, status_code(int), headers(HTTPHeaderDict))
        """

        _params = locals()

        _all_params = [
            'send_notification_request'
        ]
        _all_params.extend(
            [
                '_return_http_data_only',
                '_preload_content',
                '_request_timeout',
                '_request_auth',
                '_content_type',
                '_headers'
            ]
        )

        # validate the arguments
        for _key, _val in _params['kwargs'].items():
            if _key not in _all_params:
                raise ApiTypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method notifications_send_notification" % _key
                )
            _params[_key] = _val
        del _params['kwargs']

        _collection_formats = {}

        # process the path parameters
        _path_params = {}

        # process the query parameters
        _query_params = []
        # process the header parameters
        _header_params = dict(_params.get('_headers', {}))
        # process the form parameters
        _form_params = []
        _files = {}
        # process the body parameter
        _body_params = None
        if _params['send_notification_request'] is not None:
            _body_params = _params['send_notification_request']

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

        # set the HTTP header `Content-Type`
        _content_types_list = _params.get('_content_type',
            self.api_client.select_header_content_type(
                ['application/json']))
        if _content_types_list:
                _header_params['Content-Type'] = _content_types_list

        # authentication setting
        _auth_settings = ['APIKeyHeader']  # noqa: E501

        _response_types_map = {
            '200': "WrappedResponseBool",
            '422': "HTTPValidationError",
        }

        return await self.api_client.call_api(
            '/v1/notifications/send', 'POST',
            _path_params,
            _query_params,
            _header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            response_types_map=_response_types_map,
            auth_settings=_auth_settings,
            _return_http_data_only=_params.get('_return_http_data_only'),  # noqa: E501
            _preload_content=_params.get('_preload_content', True),
            _request_timeout=_params.get('_request_timeout'),
            collection_formats=_collection_formats,
            _request_auth=_params.get('_request_auth'))
