# 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 TireSetApi(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 tire_set_create_tire_set(self, new_tire_set, **kwargs):  # noqa: E501
        """Create a new tireset  # noqa: E501

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

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

    def tire_set_create_tire_set_with_http_info(self, new_tire_set, **kwargs):  # noqa: E501
        """Create a new tireset  # noqa: E501

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

        :param async_req bool
        :param TireSet new_tire_set: The tireset to create. (required)
        :return: TireSet
                 If the method is called asynchronously,
                 returns the request thread.
        """

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

        collection_formats = {}

        path_params = {}

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        if 'new_tire_set' in params:
            body_params = params['new_tire_set']
        # 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/tireset', 'POST',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='TireSet',  # 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 tire_set_delete_tire_set(self, tire_set_id, **kwargs):  # noqa: E501
        """Delete an existing tireset  # noqa: E501

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

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

    def tire_set_delete_tire_set_with_http_info(self, tire_set_id, **kwargs):  # noqa: E501
        """Delete an existing tireset  # noqa: E501

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

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

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

        collection_formats = {}

        path_params = {}
        if 'tire_set_id' in params:
            path_params['tireSetId'] = params['tire_set_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/tireset/{tireSetId}', '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 tire_set_get_tire_set(self, tire_set_id, **kwargs):  # noqa: E501
        """Get a tireset 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.tire_set_get_tire_set(tire_set_id, async_req=True)
        >>> result = thread.get()

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

    def tire_set_get_tire_set_with_http_info(self, tire_set_id, **kwargs):  # noqa: E501
        """Get a tireset 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.tire_set_get_tire_set_with_http_info(tire_set_id, async_req=True)
        >>> result = thread.get()

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

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

        collection_formats = {}

        path_params = {}
        if 'tire_set_id' in params:
            path_params['tireSetId'] = params['tire_set_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/tireset/{tireSetId}', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='TireSet',  # 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 tire_set_get_tire_sets_list(self, event_id, **kwargs):  # noqa: E501
        """Get the list of all tiresets for an event  # noqa: E501

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

        :param async_req bool
        :param str event_id: The unique event id for which you want to get the tireset list (required)
        :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.tire_set_get_tire_sets_list_with_http_info(event_id, **kwargs)  # noqa: E501
        else:
            (data) = self.tire_set_get_tire_sets_list_with_http_info(event_id, **kwargs)  # noqa: E501
            return data

    def tire_set_get_tire_sets_list_with_http_info(self, event_id, **kwargs):  # noqa: E501
        """Get the list of all tiresets for an event  # noqa: E501

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

        :param async_req bool
        :param str event_id: The unique event id for which you want to get the tireset list (required)
        :return: list[CoupleGuidText]
                 If the method is called asynchronously,
                 returns the request thread.
        """

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

        collection_formats = {}

        path_params = {}
        if 'event_id' in params:
            path_params['eventId'] = params['event_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/event/{eventId}/tiresets', '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 tire_set_update_tire_set(self, tire_set_id, updated_tire_set, **kwargs):  # noqa: E501
        """Update an existing TireSet  # noqa: E501

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

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

    def tire_set_update_tire_set_with_http_info(self, tire_set_id, updated_tire_set, **kwargs):  # noqa: E501
        """Update an existing TireSet  # noqa: E501

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

        :param async_req bool
        :param str tire_set_id: The unique tireset id for which you want to update the tireset (required)
        :param TireSet updated_tire_set: The tireset to update. (required)
        :return: TireSet
                 If the method is called asynchronously,
                 returns the request thread.
        """

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

        collection_formats = {}

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

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        if 'updated_tire_set' in params:
            body_params = params['updated_tire_set']
        # 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/tireset/{tireSetId}', 'PUT',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='TireSet',  # 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)
