# coding: utf-8

"""
    ThingsBoard REST API

     ThingsBoard Professional Edition IoT platform REST API documentation.  # noqa: E501

    OpenAPI spec version: 3.7.0PE-SNAPSHOT
    Contact: info@thingsboard.io
    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 tb_rest_client.api_client import ApiClient


class TranslationControllerApi(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 download_full_translation(self, locale_code, **kwargs):  # noqa: E501
        """Download end-user all-to-one translation (downloadFullTranslation)  # noqa: E501

        Fetch the end-user translation for the specified locale. The result is a json file with merged user custom translation, system language translation and default locale translation.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.download_full_translation(locale_code, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str locale_code: Locale code (e.g. 'en_US'). (required)
        :return: str
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.download_full_translation_with_http_info(locale_code, **kwargs)  # noqa: E501
        else:
            (data) = self.download_full_translation_with_http_info(locale_code, **kwargs)  # noqa: E501
            return data

    def download_full_translation_with_http_info(self, locale_code, **kwargs):  # noqa: E501
        """Download end-user all-to-one translation (downloadFullTranslation)  # noqa: E501

        Fetch the end-user translation for the specified locale. The result is a json file with merged user custom translation, system language translation and default locale translation.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.download_full_translation_with_http_info(locale_code, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str locale_code: Locale code (e.g. 'en_US'). (required)
        :return: str
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['locale_code']  # 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 download_full_translation" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'locale_code' is set
        if ('locale_code' not in params or
                params['locale_code'] is None):
            raise ValueError("Missing the required parameter `locale_code` when calling `download_full_translation`")  # noqa: E501

        collection_formats = {}

        path_params = {}
        if 'locale_code' in params:
            path_params['localeCode'] = params['locale_code']  # 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 = ['X-Authorization']  # noqa: E501

        return self.api_client.call_api(
            '/api/translation/full/{localeCode}/download', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='str',  # 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 get_available_java_locales(self, **kwargs):  # noqa: E501
        """Get list of available java locales (getAvailableJavaLocales)  # noqa: E501

        The result is map where key is locale code and value is locale language and country  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.get_available_java_locales(async_req=True)
        >>> result = thread.get()

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

    def get_available_java_locales_with_http_info(self, **kwargs):  # noqa: E501
        """Get list of available java locales (getAvailableJavaLocales)  # noqa: E501

        The result is map where key is locale code and value is locale language and country  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.get_available_java_locales_with_http_info(async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :return: JsonNode
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = []  # 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 get_available_java_locales" % key
                )
            params[key] = val
        del params['kwargs']

        collection_formats = {}

        path_params = {}

        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 = ['X-Authorization']  # noqa: E501

        return self.api_client.call_api(
            '/api/translation/availableJavaLocales', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='JsonNode',  # 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 get_available_locales(self, **kwargs):  # noqa: E501
        """Get list of available locales (getAvailableLocales)  # noqa: E501

        Fetch the list of customized locales from all levels  Security check is performed to verify that the user has 'READ' permission for the white labeling resource.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.get_available_locales(async_req=True)
        >>> result = thread.get()

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

    def get_available_locales_with_http_info(self, **kwargs):  # noqa: E501
        """Get list of available locales (getAvailableLocales)  # noqa: E501

        Fetch the list of customized locales from all levels  Security check is performed to verify that the user has 'READ' permission for the white labeling resource.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.get_available_locales_with_http_info(async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :return: JsonNode
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = []  # 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 get_available_locales" % key
                )
            params[key] = val
        del params['kwargs']

        collection_formats = {}

        path_params = {}

        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 = ['X-Authorization']  # noqa: E501

        return self.api_client.call_api(
            '/api/translation/availableLocales', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='JsonNode',  # 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 get_full_translation(self, locale_code, **kwargs):  # noqa: E501
        """Get end-user all-to-one translation (getFullTranslation)  # noqa: E501

        Fetch the end-user translation for specified locale. The result is the merge of user custom translation, system language translation and default locale translation.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.get_full_translation(locale_code, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str locale_code: Locale code (e.g. 'en_US'). (required)
        :param str if_none_match:
        :param str accept_encoding:
        :return: None
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.get_full_translation_with_http_info(locale_code, **kwargs)  # noqa: E501
        else:
            (data) = self.get_full_translation_with_http_info(locale_code, **kwargs)  # noqa: E501
            return data

    def get_full_translation_with_http_info(self, locale_code, **kwargs):  # noqa: E501
        """Get end-user all-to-one translation (getFullTranslation)  # noqa: E501

        Fetch the end-user translation for specified locale. The result is the merge of user custom translation, system language translation and default locale translation.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.get_full_translation_with_http_info(locale_code, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str locale_code: Locale code (e.g. 'en_US'). (required)
        :param str if_none_match:
        :param str accept_encoding:
        :return: None
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['locale_code', 'if_none_match', 'accept_encoding']  # 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 get_full_translation" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'locale_code' is set
        if ('locale_code' not in params or
                params['locale_code'] is None):
            raise ValueError("Missing the required parameter `locale_code` when calling `get_full_translation`")  # noqa: E501

        collection_formats = {}

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

        query_params = []

        header_params = {}
        if 'if_none_match' in params:
            header_params['If-None-Match'] = params['if_none_match']  # noqa: E501
        if 'accept_encoding' in params:
            header_params['Accept-Encoding'] = params['accept_encoding']  # noqa: E501

        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 = ['X-Authorization']  # noqa: E501

        return self.api_client.call_api(
            '/api/translation/full/{localeCode}', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='JsonNode',  # 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 get_login_page_translation(self, locale_code, **kwargs):  # noqa: E501
        """Get system translation for login page  # noqa: E501

        Fetch the end-user translation for specified locale.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.get_login_page_translation(locale_code, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str locale_code: Locale code (e.g. 'en_US'). (required)
        :param str if_none_match:
        :param str accept_encoding:
        :return: None
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.get_login_page_translation_with_http_info(locale_code, **kwargs)  # noqa: E501
        else:
            (data) = self.get_login_page_translation_with_http_info(locale_code, **kwargs)  # noqa: E501
            return data

    def get_login_page_translation_with_http_info(self, locale_code, **kwargs):  # noqa: E501
        """Get system translation for login page  # noqa: E501

        Fetch the end-user translation for specified locale.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.get_login_page_translation_with_http_info(locale_code, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str locale_code: Locale code (e.g. 'en_US'). (required)
        :param str if_none_match:
        :param str accept_encoding:
        :return: None
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['locale_code', 'if_none_match', 'accept_encoding']  # 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 get_login_page_translation" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'locale_code' is set
        if ('locale_code' not in params or
                params['locale_code'] is None):
            raise ValueError("Missing the required parameter `locale_code` when calling `get_login_page_translation`")  # noqa: E501

        collection_formats = {}

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

        query_params = []

        header_params = {}
        if 'if_none_match' in params:
            header_params['If-None-Match'] = params['if_none_match']  # noqa: E501
        if 'accept_encoding' in params:
            header_params['Accept-Encoding'] = params['accept_encoding']  # noqa: E501

        form_params = []
        local_var_files = {}

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

        # Authentication setting
        auth_settings = []  # noqa: E501

        return self.api_client.call_api(
            '/api/noauth/translation/login/{localeCode}', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='Resource',  # 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 get_translation_for_basic_edit(self, locale_code, **kwargs):  # noqa: E501
        """Get end-user multi-translation for basic edit (getTranslationForBasicEdit)  # noqa: E501

        Fetch the translation info map where value is info object containing key translation, origin translation, translation of parent level, translation status.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.get_translation_for_basic_edit(locale_code, async_req=True)
        >>> result = thread.get()

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

    def get_translation_for_basic_edit_with_http_info(self, locale_code, **kwargs):  # noqa: E501
        """Get end-user multi-translation for basic edit (getTranslationForBasicEdit)  # noqa: E501

        Fetch the translation info map where value is info object containing key translation, origin translation, translation of parent level, translation status.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.get_translation_for_basic_edit_with_http_info(locale_code, async_req=True)
        >>> result = thread.get()

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

        all_params = ['locale_code']  # 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 get_translation_for_basic_edit" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'locale_code' is set
        if ('locale_code' not in params or
                params['locale_code'] is None):
            raise ValueError("Missing the required parameter `locale_code` when calling `get_translation_for_basic_edit`")  # noqa: E501

        collection_formats = {}

        path_params = {}
        if 'locale_code' in params:
            path_params['localeCode'] = params['locale_code']  # 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 = ['X-Authorization']  # noqa: E501

        return self.api_client.call_api(
            '/api/translation/edit/basic/{localeCode}', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='JsonNode',  # 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 get_translation_infos(self, **kwargs):  # noqa: E501
        """Get Translation info (getTranslationInfos)  # noqa: E501

        Fetch the list of customized locales and corresponding details such as language display name, country display name and translation progress percentage.   Response example:   ```json [   {     \"localeCode\": \"uk_UA\",     \"language\": \"Ukrainian (українська)\",     \"country\": \"Україна\",     \"progress\": 32   },   {     \"localeCode\": \"es_ES\",     \"language\": \"Spanish (español)\",     \"country\": \"España\",     \"progress\": 79   }] ```  Security check is performed to verify that the user has 'READ' permission for the white labeling resource.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.get_translation_infos(async_req=True)
        >>> result = thread.get()

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

    def get_translation_infos_with_http_info(self, **kwargs):  # noqa: E501
        """Get Translation info (getTranslationInfos)  # noqa: E501

        Fetch the list of customized locales and corresponding details such as language display name, country display name and translation progress percentage.   Response example:   ```json [   {     \"localeCode\": \"uk_UA\",     \"language\": \"Ukrainian (українська)\",     \"country\": \"Україна\",     \"progress\": 32   },   {     \"localeCode\": \"es_ES\",     \"language\": \"Spanish (español)\",     \"country\": \"España\",     \"progress\": 79   }] ```  Security check is performed to verify that the user has 'READ' permission for the white labeling resource.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.get_translation_infos_with_http_info(async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :return: list[TranslationInfo]
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = []  # 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 get_translation_infos" % key
                )
            params[key] = val
        del params['kwargs']

        collection_formats = {}

        path_params = {}

        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 = ['X-Authorization']  # noqa: E501

        return self.api_client.call_api(
            '/api/translation/info', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='list[TranslationInfo]',  # 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)
