# coding: utf-8

"""
    Trackside Software TeamDB API v2.0

    This API enables you to access TeamDB data  # noqa: E501

    OpenAPI spec version: 2.0
    Contact: support@trackside.fr
    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 teamdbapi.api_client import ApiClient


class TrackApi(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 track_create_track(self, new_track, **kwargs):  # noqa: E501
        """Create a new track  # noqa: E501

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

        :param async_req bool
        :param Track new_track: The track to create. (required)
        :return: Track
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.track_create_track_with_http_info(new_track, **kwargs)  # noqa: E501
        else:
            (data) = self.track_create_track_with_http_info(new_track, **kwargs)  # noqa: E501
            return data

    def track_create_track_with_http_info(self, new_track, **kwargs):  # noqa: E501
        """Create a new track  # noqa: E501

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

        :param async_req bool
        :param Track new_track: The track to create. (required)
        :return: Track
                 If the method is called asynchronously,
                 returns the request thread.
        """

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

        collection_formats = {}

        path_params = {}

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

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

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

        # Authentication setting
        auth_settings = []  # noqa: E501

        return self.api_client.call_api(
            '/teamdbapi/v2.0/track', 'POST',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='Track',  # 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 track_delete_track(self, track_id, **kwargs):  # noqa: E501
        """Delete an existing track  # noqa: E501

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

        :param async_req bool
        :param str track_id: The unique track id for which you want to delete the track (required)
        :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.track_delete_track_with_http_info(track_id, **kwargs)  # noqa: E501
        else:
            (data) = self.track_delete_track_with_http_info(track_id, **kwargs)  # noqa: E501
            return data

    def track_delete_track_with_http_info(self, track_id, **kwargs):  # noqa: E501
        """Delete an existing track  # noqa: E501

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

        :param async_req bool
        :param str track_id: The unique track id for which you want to delete the track (required)
        :return: None
                 If the method is called asynchronously,
                 returns the request thread.
        """

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

        collection_formats = {}

        path_params = {}
        if 'track_id' in params:
            path_params['trackId'] = params['track_id']  # 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', 'text/json'])  # noqa: E501

        # Authentication setting
        auth_settings = []  # noqa: E501

        return self.api_client.call_api(
            '/teamdbapi/v2.0/track/{trackId}', 'DELETE',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type=None,  # 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 track_get_track(self, track_id, **kwargs):  # noqa: E501
        """Get an track via a unique id.  # noqa: E501

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

        :param async_req bool
        :param str track_id: The unique track id for which you want to get the track (required)
        :return: Track
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.track_get_track_with_http_info(track_id, **kwargs)  # noqa: E501
        else:
            (data) = self.track_get_track_with_http_info(track_id, **kwargs)  # noqa: E501
            return data

    def track_get_track_with_http_info(self, track_id, **kwargs):  # noqa: E501
        """Get an track via a unique id.  # noqa: E501

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

        :param async_req bool
        :param str track_id: The unique track id for which you want to get the track (required)
        :return: Track
                 If the method is called asynchronously,
                 returns the request thread.
        """

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

        collection_formats = {}

        path_params = {}
        if 'track_id' in params:
            path_params['trackId'] = params['track_id']  # 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', 'text/json'])  # noqa: E501

        # Authentication setting
        auth_settings = []  # noqa: E501

        return self.api_client.call_api(
            '/teamdbapi/v2.0/track/{trackId}', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='Track',  # 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 track_get_tracks(self, **kwargs):  # noqa: E501
        """Get the list of all tracks  # noqa: E501

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

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

    def track_get_tracks_with_http_info(self, **kwargs):  # noqa: E501
        """Get the list of all tracks  # noqa: E501

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

        :param async_req bool
        :return: list[CoupleGuidText]
                 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 track_get_tracks" % 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', 'text/json'])  # noqa: E501

        # Authentication setting
        auth_settings = []  # noqa: E501

        return self.api_client.call_api(
            '/teamdbapi/v2.0/tracks', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='list[CoupleGuidText]',  # 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 track_update_track(self, track_id, updated_track, **kwargs):  # noqa: E501
        """Update an existing track  # noqa: E501

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

        :param async_req bool
        :param str track_id: The unique track id for which you want to update the track (required)
        :param Track updated_track: The track to update. (required)
        :return: Track
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.track_update_track_with_http_info(track_id, updated_track, **kwargs)  # noqa: E501
        else:
            (data) = self.track_update_track_with_http_info(track_id, updated_track, **kwargs)  # noqa: E501
            return data

    def track_update_track_with_http_info(self, track_id, updated_track, **kwargs):  # noqa: E501
        """Update an existing track  # noqa: E501

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

        :param async_req bool
        :param str track_id: The unique track id for which you want to update the track (required)
        :param Track updated_track: The track to update. (required)
        :return: Track
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['track_id', 'updated_track']  # 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 track_update_track" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'track_id' is set
        if self.api_client.client_side_validation and ('track_id' not in params or
                                                       params['track_id'] is None):  # noqa: E501
            raise ValueError("Missing the required parameter `track_id` when calling `track_update_track`")  # noqa: E501
        # verify the required parameter 'updated_track' is set
        if self.api_client.client_side_validation and ('updated_track' not in params or
                                                       params['updated_track'] is None):  # noqa: E501
            raise ValueError("Missing the required parameter `updated_track` when calling `track_update_track`")  # noqa: E501

        collection_formats = {}

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

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

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

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

        # Authentication setting
        auth_settings = []  # noqa: E501

        return self.api_client.call_api(
            '/teamdbapi/v2.0/track/{trackId}', 'PUT',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='Track',  # 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)
