# coding: utf-8

"""
    SYSNET CRZP connector API

    SYSNET CRŽP connector REST API (IPPC & CITES extension)  # noqa: E501

    OpenAPI spec version: 1.1.0
    Contact: info@sysnet.cz
    Generated by: https://github.com/swagger-api/swagger-codegen.git
"""

from __future__ import absolute_import

import re  # noqa: F401

# python 2 and python 3 compatibility library
import six

from crzp.api_client import ApiClient


class PublicApi(object):
    """NOTE: This class is auto generated by the swagger code generator program.

    Do not edit the class manually.
    Ref: https://github.com/swagger-api/swagger-codegen
    """

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

    def role_holder_api(self, object_type, code, **kwargs):  # noqa: E501
        """Get all role holders  # noqa: E501

        Returns all role holders   # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.role_holder_api(object_type, code, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param RoleHolderObjectType object_type: (required)
        :param str code: Role code or identifier (required)
        :param datetime updated: Last modification datetime
        :return: RoleHolders
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.role_holder_api_with_http_info(object_type, code, **kwargs)  # noqa: E501
        else:
            (data) = self.role_holder_api_with_http_info(object_type, code, **kwargs)  # noqa: E501
            return data

    def role_holder_api_with_http_info(self, object_type, code, **kwargs):  # noqa: E501
        """Get all role holders  # noqa: E501

        Returns all role holders   # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.role_holder_api_with_http_info(object_type, code, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param RoleHolderObjectType object_type: (required)
        :param str code: Role code or identifier (required)
        :param datetime updated: Last modification datetime
        :return: RoleHolders
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['object_type', 'code', 'updated']  # noqa: E501
        all_params.append('async_req')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

        params = locals()
        for key, val in six.iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method role_holder_api" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'object_type' is set
        if ('object_type' not in params or
                params['object_type'] is None):
            raise ValueError("Missing the required parameter `object_type` when calling `role_holder_api`")  # noqa: E501
        # verify the required parameter 'code' is set
        if ('code' not in params or
                params['code'] is None):
            raise ValueError("Missing the required parameter `code` when calling `role_holder_api`")  # noqa: E501

        collection_formats = {}

        path_params = {}
        if 'object_type' in params:
            path_params['object_type'] = params['object_type']  # noqa: E501
        if 'code' in params:
            path_params['code'] = params['code']  # noqa: E501

        query_params = []
        if 'updated' in params:
            query_params.append(('updated', params['updated']))  # noqa: E501

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['application/json'])  # noqa: E501

        # Authentication setting
        auth_settings = ['apiKey']  # noqa: E501

        return self.api_client.call_api(
            '/role-holder/{object_type}/{code}', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='RoleHolders',  # noqa: E501
            auth_settings=auth_settings,
            async_req=params.get('async_req'),
            _return_http_data_only=params.get('_return_http_data_only'),
            _preload_content=params.get('_preload_content', True),
            _request_timeout=params.get('_request_timeout'),
            collection_formats=collection_formats)

    def role_holder_ft_api(self, object_type, query, **kwargs):  # noqa: E501
        """Get all roles and holders by FT query  # noqa: E501

        Returns all roles and holders for a query string   # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.role_holder_ft_api(object_type, query, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param RoleHolderObjectType object_type: (required)
        :param str query: Fulltext query content (required)
        :return: RoleHolders
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.role_holder_ft_api_with_http_info(object_type, query, **kwargs)  # noqa: E501
        else:
            (data) = self.role_holder_ft_api_with_http_info(object_type, query, **kwargs)  # noqa: E501
            return data

    def role_holder_ft_api_with_http_info(self, object_type, query, **kwargs):  # noqa: E501
        """Get all roles and holders by FT query  # noqa: E501

        Returns all roles and holders for a query string   # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.role_holder_ft_api_with_http_info(object_type, query, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param RoleHolderObjectType object_type: (required)
        :param str query: Fulltext query content (required)
        :return: RoleHolders
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['object_type', 'query']  # noqa: E501
        all_params.append('async_req')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

        params = locals()
        for key, val in six.iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method role_holder_ft_api" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'object_type' is set
        if ('object_type' not in params or
                params['object_type'] is None):
            raise ValueError("Missing the required parameter `object_type` when calling `role_holder_ft_api`")  # noqa: E501
        # verify the required parameter 'query' is set
        if ('query' not in params or
                params['query'] is None):
            raise ValueError("Missing the required parameter `query` when calling `role_holder_ft_api`")  # noqa: E501

        collection_formats = {}

        path_params = {}
        if 'object_type' in params:
            path_params['object_type'] = params['object_type']  # noqa: E501

        query_params = []
        if 'query' in params:
            query_params.append(('query', params['query']))  # noqa: E501

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['application/json'])  # noqa: E501

        # Authentication setting
        auth_settings = ['apiKey']  # noqa: E501

        return self.api_client.call_api(
            '/role-holder/{object_type}', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='RoleHolders',  # noqa: E501
            auth_settings=auth_settings,
            async_req=params.get('async_req'),
            _return_http_data_only=params.get('_return_http_data_only'),
            _preload_content=params.get('_preload_content', True),
            _request_timeout=params.get('_request_timeout'),
            collection_formats=collection_formats)

    def role_holder_ft_paging_api(self, object_type, begin, query, **kwargs):  # noqa: E501
        """Get all roles and holders by FT query (pagination)  # noqa: E501

        Returns all roles and holders from last returner identifier   # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.role_holder_ft_paging_api(object_type, begin, query, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param RoleHolderObjectType object_type: (required)
        :param str begin: if the previous query did not return all occurrences,  start searching from this identifier  (required)
        :param str query: Fulltext query content (required)
        :return: RoleHolders
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.role_holder_ft_paging_api_with_http_info(object_type, begin, query, **kwargs)  # noqa: E501
        else:
            (data) = self.role_holder_ft_paging_api_with_http_info(object_type, begin, query, **kwargs)  # noqa: E501
            return data

    def role_holder_ft_paging_api_with_http_info(self, object_type, begin, query, **kwargs):  # noqa: E501
        """Get all roles and holders by FT query (pagination)  # noqa: E501

        Returns all roles and holders from last returner identifier   # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.role_holder_ft_paging_api_with_http_info(object_type, begin, query, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param RoleHolderObjectType object_type: (required)
        :param str begin: if the previous query did not return all occurrences,  start searching from this identifier  (required)
        :param str query: Fulltext query content (required)
        :return: RoleHolders
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['object_type', 'begin', 'query']  # noqa: E501
        all_params.append('async_req')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

        params = locals()
        for key, val in six.iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method role_holder_ft_paging_api" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'object_type' is set
        if ('object_type' not in params or
                params['object_type'] is None):
            raise ValueError("Missing the required parameter `object_type` when calling `role_holder_ft_paging_api`")  # noqa: E501
        # verify the required parameter 'begin' is set
        if ('begin' not in params or
                params['begin'] is None):
            raise ValueError("Missing the required parameter `begin` when calling `role_holder_ft_paging_api`")  # noqa: E501
        # verify the required parameter 'query' is set
        if ('query' not in params or
                params['query'] is None):
            raise ValueError("Missing the required parameter `query` when calling `role_holder_ft_paging_api`")  # noqa: E501

        collection_formats = {}

        path_params = {}
        if 'object_type' in params:
            path_params['object_type'] = params['object_type']  # noqa: E501
        if 'begin' in params:
            path_params['begin'] = params['begin']  # noqa: E501

        query_params = []
        if 'query' in params:
            query_params.append(('query', params['query']))  # noqa: E501

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['application/json'])  # noqa: E501

        # Authentication setting
        auth_settings = ['apiKey']  # noqa: E501

        return self.api_client.call_api(
            '/role-holder/{object_type}/{begin}', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='RoleHolders',  # noqa: E501
            auth_settings=auth_settings,
            async_req=params.get('async_req'),
            _return_http_data_only=params.get('_return_http_data_only'),
            _preload_content=params.get('_preload_content', True),
            _request_timeout=params.get('_request_timeout'),
            collection_formats=collection_formats)

    def role_holder_paging_api(self, object_type, code, begin, **kwargs):  # noqa: E501
        """Get all role holders (pagination)  # noqa: E501

        Returns all role holders from last returner identifier    # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.role_holder_paging_api(object_type, code, begin, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param RoleHolderObjectType object_type: (required)
        :param str code: Role code or identifier (required)
        :param str begin: if the previous query did not return all occurrences,  start searching from this identifier  (required)
        :param datetime updated: Last modification datetime
        :return: RoleHolders
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.role_holder_paging_api_with_http_info(object_type, code, begin, **kwargs)  # noqa: E501
        else:
            (data) = self.role_holder_paging_api_with_http_info(object_type, code, begin, **kwargs)  # noqa: E501
            return data

    def role_holder_paging_api_with_http_info(self, object_type, code, begin, **kwargs):  # noqa: E501
        """Get all role holders (pagination)  # noqa: E501

        Returns all role holders from last returner identifier    # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.role_holder_paging_api_with_http_info(object_type, code, begin, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param RoleHolderObjectType object_type: (required)
        :param str code: Role code or identifier (required)
        :param str begin: if the previous query did not return all occurrences,  start searching from this identifier  (required)
        :param datetime updated: Last modification datetime
        :return: RoleHolders
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['object_type', 'code', 'begin', 'updated']  # noqa: E501
        all_params.append('async_req')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

        params = locals()
        for key, val in six.iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method role_holder_paging_api" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'object_type' is set
        if ('object_type' not in params or
                params['object_type'] is None):
            raise ValueError("Missing the required parameter `object_type` when calling `role_holder_paging_api`")  # noqa: E501
        # verify the required parameter 'code' is set
        if ('code' not in params or
                params['code'] is None):
            raise ValueError("Missing the required parameter `code` when calling `role_holder_paging_api`")  # noqa: E501
        # verify the required parameter 'begin' is set
        if ('begin' not in params or
                params['begin'] is None):
            raise ValueError("Missing the required parameter `begin` when calling `role_holder_paging_api`")  # noqa: E501

        collection_formats = {}

        path_params = {}
        if 'object_type' in params:
            path_params['object_type'] = params['object_type']  # noqa: E501
        if 'code' in params:
            path_params['code'] = params['code']  # noqa: E501
        if 'begin' in params:
            path_params['begin'] = params['begin']  # noqa: E501

        query_params = []
        if 'updated' in params:
            query_params.append(('updated', params['updated']))  # noqa: E501

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['application/json'])  # noqa: E501

        # Authentication setting
        auth_settings = ['apiKey']  # noqa: E501

        return self.api_client.call_api(
            '/role-holder/{object_type}/{code}/{begin}', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='RoleHolders',  # noqa: E501
            auth_settings=auth_settings,
            async_req=params.get('async_req'),
            _return_http_data_only=params.get('_return_http_data_only'),
            _preload_content=params.get('_preload_content', True),
            _request_timeout=params.get('_request_timeout'),
            collection_formats=collection_formats)

    def subject_api(self, identifier, **kwargs):  # noqa: E501
        """Get user detail  # noqa: E501

        Returns subject details   # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.subject_api(identifier, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str identifier: Subject identifier (required)
        :return: SubjectDetail
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.subject_api_with_http_info(identifier, **kwargs)  # noqa: E501
        else:
            (data) = self.subject_api_with_http_info(identifier, **kwargs)  # noqa: E501
            return data

    def subject_api_with_http_info(self, identifier, **kwargs):  # noqa: E501
        """Get user detail  # noqa: E501

        Returns subject details   # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.subject_api_with_http_info(identifier, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str identifier: Subject identifier (required)
        :return: SubjectDetail
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['identifier']  # noqa: E501
        all_params.append('async_req')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

        params = locals()
        for key, val in six.iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method subject_api" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'identifier' is set
        if ('identifier' not in params or
                params['identifier'] is None):
            raise ValueError("Missing the required parameter `identifier` when calling `subject_api`")  # noqa: E501

        collection_formats = {}

        path_params = {}
        if 'identifier' in params:
            path_params['identifier'] = params['identifier']  # noqa: E501

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['application/json'])  # noqa: E501

        # Authentication setting
        auth_settings = ['apiKey']  # noqa: E501

        return self.api_client.call_api(
            '/subject/{identifier}', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='SubjectDetail',  # noqa: E501
            auth_settings=auth_settings,
            async_req=params.get('async_req'),
            _return_http_data_only=params.get('_return_http_data_only'),
            _preload_content=params.get('_preload_content', True),
            _request_timeout=params.get('_request_timeout'),
            collection_formats=collection_formats)

    def user_api(self, identifier, **kwargs):  # noqa: E501
        """Get user detail  # noqa: E501

        Returns user details - username, emal, name, etc.   # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.user_api(identifier, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str identifier: User identifier (required)
        :return: User
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.user_api_with_http_info(identifier, **kwargs)  # noqa: E501
        else:
            (data) = self.user_api_with_http_info(identifier, **kwargs)  # noqa: E501
            return data

    def user_api_with_http_info(self, identifier, **kwargs):  # noqa: E501
        """Get user detail  # noqa: E501

        Returns user details - username, emal, name, etc.   # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.user_api_with_http_info(identifier, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str identifier: User identifier (required)
        :return: User
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['identifier']  # noqa: E501
        all_params.append('async_req')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

        params = locals()
        for key, val in six.iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method user_api" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'identifier' is set
        if ('identifier' not in params or
                params['identifier'] is None):
            raise ValueError("Missing the required parameter `identifier` when calling `user_api`")  # noqa: E501

        collection_formats = {}

        path_params = {}
        if 'identifier' in params:
            path_params['identifier'] = params['identifier']  # noqa: E501

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['application/json'])  # noqa: E501

        # Authentication setting
        auth_settings = ['apiKey']  # noqa: E501

        return self.api_client.call_api(
            '/user/{identifier}', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='User',  # noqa: E501
            auth_settings=auth_settings,
            async_req=params.get('async_req'),
            _return_http_data_only=params.get('_return_http_data_only'),
            _preload_content=params.get('_preload_content', True),
            _request_timeout=params.get('_request_timeout'),
            collection_formats=collection_formats)

    def user_context_api(self, identifier, **kwargs):  # noqa: E501
        """Get user context  # noqa: E501

        Returns user context - systems, roles, etc.   # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.user_context_api(identifier, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str identifier: User identifier (required)
        :return: UserContext
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.user_context_api_with_http_info(identifier, **kwargs)  # noqa: E501
        else:
            (data) = self.user_context_api_with_http_info(identifier, **kwargs)  # noqa: E501
            return data

    def user_context_api_with_http_info(self, identifier, **kwargs):  # noqa: E501
        """Get user context  # noqa: E501

        Returns user context - systems, roles, etc.   # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.user_context_api_with_http_info(identifier, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str identifier: User identifier (required)
        :return: UserContext
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['identifier']  # noqa: E501
        all_params.append('async_req')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

        params = locals()
        for key, val in six.iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method user_context_api" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'identifier' is set
        if ('identifier' not in params or
                params['identifier'] is None):
            raise ValueError("Missing the required parameter `identifier` when calling `user_context_api`")  # noqa: E501

        collection_formats = {}

        path_params = {}
        if 'identifier' in params:
            path_params['identifier'] = params['identifier']  # noqa: E501

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['application/json'])  # noqa: E501

        # Authentication setting
        auth_settings = ['apiKey']  # noqa: E501

        return self.api_client.call_api(
            '/user-context/{identifier}', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='UserContext',  # noqa: E501
            auth_settings=auth_settings,
            async_req=params.get('async_req'),
            _return_http_data_only=params.get('_return_http_data_only'),
            _preload_content=params.get('_preload_content', True),
            _request_timeout=params.get('_request_timeout'),
            collection_formats=collection_formats)
