# coding: utf-8

"""
    Marketcheck Cars API

    <b>Access the New, Used and Certified cars inventories for all Car Dealers in US.</b> <br/>The data is sourced from online listings by over 44,000 Car dealers in US. At any time, there are about 6.2M searchable listings (about 1.9M unique VINs) for Used & Certified cars and about 6.6M (about 3.9M unique VINs) New Car listings from all over US. We use this API at the back for our website <a href='https://www.marketcheck.com' target='_blank'>www.marketcheck.com</a> and our Android and iOS mobile apps too.<br/><h5> Few useful links : </h5><ul><li>A quick view of the API and the use cases is depicated <a href='https://portals.marketcheck.com/mcapi/' target='_blank'>here</a></li><li>The Postman collection with various usages of the API is shared here https://www.getpostman.com/collections/2752684ff636cdd7bac2</li></ul>  # noqa: E501

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


class VINDecoderApi(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 decode(self, vin, **kwargs):  # noqa: E501
        """VIN Decoder  # noqa: E501

        Get the basic information on specifications for a car identified by a valid VIN  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async=True
        >>> thread = api.decode(vin, async=True)
        >>> result = thread.get()

        :param async bool
        :param str vin: VIN to decode (required)
        :param str api_key: The API Authentication Key. Mandatory with all API calls.
        :return: Build
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async'):
            return self.decode_with_http_info(vin, **kwargs)  # noqa: E501
        else:
            (data) = self.decode_with_http_info(vin, **kwargs)  # noqa: E501
            return data

    def decode_with_http_info(self, vin, **kwargs):  # noqa: E501
        """VIN Decoder  # noqa: E501

        Get the basic information on specifications for a car identified by a valid VIN  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async=True
        >>> thread = api.decode_with_http_info(vin, async=True)
        >>> result = thread.get()

        :param async bool
        :param str vin: VIN to decode (required)
        :param str api_key: The API Authentication Key. Mandatory with all API calls.
        :return: Build
                 If the method is called asynchronously,
                 returns the request thread.
        """

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

        collection_formats = {}

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

        query_params = []
        if 'api_key' in params:
            query_params.append(('api_key', params['api_key']))  # 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 = []  # noqa: E501

        return self.api_client.call_api(
            '/vin/{vin}/specs', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='Build',  # noqa: E501
            auth_settings=auth_settings,
            async=params.get('async'),
            _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_economy(self, vin, **kwargs):  # noqa: E501
        """Get Economy based on environmental factors  # noqa: E501

        [MOCK] Calculate Economy i.e. Environmental Friendliness  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async=True
        >>> thread = api.get_economy(vin, async=True)
        >>> result = thread.get()

        :param async bool
        :param str vin: VIN as a reference to the type of car for which Environmental Economy data is to be returned (required)
        :param str api_key: The API Authentication Key. Mandatory with all API calls.
        :return: Economy
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async'):
            return self.get_economy_with_http_info(vin, **kwargs)  # noqa: E501
        else:
            (data) = self.get_economy_with_http_info(vin, **kwargs)  # noqa: E501
            return data

    def get_economy_with_http_info(self, vin, **kwargs):  # noqa: E501
        """Get Economy based on environmental factors  # noqa: E501

        [MOCK] Calculate Economy i.e. Environmental Friendliness  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async=True
        >>> thread = api.get_economy_with_http_info(vin, async=True)
        >>> result = thread.get()

        :param async bool
        :param str vin: VIN as a reference to the type of car for which Environmental Economy data is to be returned (required)
        :param str api_key: The API Authentication Key. Mandatory with all API calls.
        :return: Economy
                 If the method is called asynchronously,
                 returns the request thread.
        """

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

        collection_formats = {}

        path_params = {}

        query_params = []
        if 'api_key' in params:
            query_params.append(('api_key', params['api_key']))  # noqa: E501
        if 'vin' in params:
            query_params.append(('vin', params['vin']))  # 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 = []  # noqa: E501

        return self.api_client.call_api(
            '/economy', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='Economy',  # noqa: E501
            auth_settings=auth_settings,
            async=params.get('async'),
            _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_efficiency(self, vin, **kwargs):  # noqa: E501
        """Get fuel effeciency  # noqa: E501

        [MOCK] Calculate fuel efficiency from taxonomy db mileage values  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async=True
        >>> thread = api.get_efficiency(vin, async=True)
        >>> result = thread.get()

        :param async bool
        :param str vin: VIN as a reference to the type of car for which fuel data is to be returned (required)
        :param str api_key: The API Authentication Key. Mandatory with all API calls.
        :return: FuelEfficiency
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async'):
            return self.get_efficiency_with_http_info(vin, **kwargs)  # noqa: E501
        else:
            (data) = self.get_efficiency_with_http_info(vin, **kwargs)  # noqa: E501
            return data

    def get_efficiency_with_http_info(self, vin, **kwargs):  # noqa: E501
        """Get fuel effeciency  # noqa: E501

        [MOCK] Calculate fuel efficiency from taxonomy db mileage values  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async=True
        >>> thread = api.get_efficiency_with_http_info(vin, async=True)
        >>> result = thread.get()

        :param async bool
        :param str vin: VIN as a reference to the type of car for which fuel data is to be returned (required)
        :param str api_key: The API Authentication Key. Mandatory with all API calls.
        :return: FuelEfficiency
                 If the method is called asynchronously,
                 returns the request thread.
        """

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

        collection_formats = {}

        path_params = {}

        query_params = []
        if 'api_key' in params:
            query_params.append(('api_key', params['api_key']))  # noqa: E501
        if 'vin' in params:
            query_params.append(('vin', params['vin']))  # 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 = []  # noqa: E501

        return self.api_client.call_api(
            '/fuel_efficiency', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='FuelEfficiency',  # noqa: E501
            auth_settings=auth_settings,
            async=params.get('async'),
            _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_safety_rating(self, vin, **kwargs):  # noqa: E501
        """Get Safety Rating  # noqa: E501

        [MOCK] Get Safety ratings from third party sources  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async=True
        >>> thread = api.get_safety_rating(vin, async=True)
        >>> result = thread.get()

        :param async bool
        :param str vin: VIN to fetch the safety ratings (required)
        :param str api_key: The API Authentication Key. Mandatory with all API calls.
        :return: SafetyRating
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async'):
            return self.get_safety_rating_with_http_info(vin, **kwargs)  # noqa: E501
        else:
            (data) = self.get_safety_rating_with_http_info(vin, **kwargs)  # noqa: E501
            return data

    def get_safety_rating_with_http_info(self, vin, **kwargs):  # noqa: E501
        """Get Safety Rating  # noqa: E501

        [MOCK] Get Safety ratings from third party sources  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async=True
        >>> thread = api.get_safety_rating_with_http_info(vin, async=True)
        >>> result = thread.get()

        :param async bool
        :param str vin: VIN to fetch the safety ratings (required)
        :param str api_key: The API Authentication Key. Mandatory with all API calls.
        :return: SafetyRating
                 If the method is called asynchronously,
                 returns the request thread.
        """

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

        collection_formats = {}

        path_params = {}

        query_params = []
        if 'api_key' in params:
            query_params.append(('api_key', params['api_key']))  # noqa: E501
        if 'vin' in params:
            query_params.append(('vin', params['vin']))  # 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 = []  # noqa: E501

        return self.api_client.call_api(
            '/safety', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='SafetyRating',  # noqa: E501
            auth_settings=auth_settings,
            async=params.get('async'),
            _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)
