# coding: utf-8

"""
    timelight

    This is the timelight api.  # noqa: E501

    OpenAPI spec version: 1.0
    
    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 timelight_ai_python_api_client.api_client import ApiClient


class UserApi(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 v1_user_login_post(self, login_dto, **kwargs):  # noqa: E501
        """Log the user in  # noqa: E501

        This endpoints returns the jwt and sets a cookie with the same jwt.      This way you can use it from both an api and a browser  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.v1_user_login_post(login_dto, async_req=True)
        >>> result = thread.get()

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

    def v1_user_login_post_with_http_info(self, login_dto, **kwargs):  # noqa: E501
        """Log the user in  # noqa: E501

        This endpoints returns the jwt and sets a cookie with the same jwt.      This way you can use it from both an api and a browser  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.v1_user_login_post_with_http_info(login_dto, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param LoginDto login_dto: (required)
        :return: LoginResponseDto
                 If the method is called asynchronously,
                 returns the request thread.
        """

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

        collection_formats = {}

        path_params = {}

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

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

        # HTTP header `Content-Type`
        header_params['Content-Type'] = self.api_client.select_header_content_type(  # noqa: E501
            ['application/json'])  # noqa: E501

        # Authentication setting
        auth_settings = []  # noqa: E501

        return self.api_client.call_api(
            '/v1/user/login', 'POST',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='LoginResponseDto',  # 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 v1_user_me_get(self, **kwargs):  # noqa: E501
        """Retrieve current user information  # noqa: E501

        Must be authenticated to call this endpoint  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.v1_user_me_get(async_req=True)
        >>> result = thread.get()

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

    def v1_user_me_get_with_http_info(self, **kwargs):  # noqa: E501
        """Retrieve current user information  # noqa: E501

        Must be authenticated to call this endpoint  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.v1_user_me_get_with_http_info(async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :return: UserDto
                 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 v1_user_me_get" % 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

        # HTTP header `Content-Type`
        header_params['Content-Type'] = self.api_client.select_header_content_type(  # noqa: E501
            ['application/json'])  # noqa: E501

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

        return self.api_client.call_api(
            '/v1/user/me', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='UserDto',  # 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 v1_user_register_demo_post(self, request_demo_dto, **kwargs):  # noqa: E501
        """v1_user_register_demo_post  # noqa: E501

        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.v1_user_register_demo_post(request_demo_dto, async_req=True)
        >>> result = thread.get()

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

    def v1_user_register_demo_post_with_http_info(self, request_demo_dto, **kwargs):  # noqa: E501
        """v1_user_register_demo_post  # noqa: E501

        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.v1_user_register_demo_post_with_http_info(request_demo_dto, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param RequestDemoDto request_demo_dto: (required)
        :return: LoginResponseDto
                 If the method is called asynchronously,
                 returns the request thread.
        """

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

        collection_formats = {}

        path_params = {}

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

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

        # HTTP header `Content-Type`
        header_params['Content-Type'] = self.api_client.select_header_content_type(  # noqa: E501
            ['application/json'])  # noqa: E501

        # Authentication setting
        auth_settings = []  # noqa: E501

        return self.api_client.call_api(
            '/v1/user/register-demo', 'POST',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='LoginResponseDto',  # 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)
