# coding: utf-8

"""
    CodeChef API

    CodeChef API to support different applications.  # noqa: E501

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


class ContestProblemsApi(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 contests_contest_code_problems_problem_code_get(self, problem_code, contest_code, **kwargs):  # noqa: E501
        """Get details of a problem.  # noqa: E501

        Takes problemCode as the parameter and fetches details of that problem.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async=True
        >>> thread = api.contests_contest_code_problems_problem_code_get(problem_code, contest_code, async=True)
        >>> result = thread.get()

        :param async bool
        :param str problem_code: Problem code of the problem, eg. SALARY (required)
        :param str contest_code: Contest code of the contest, eg. PRACTICE, COOK97, JAN17 (required)
        :param str fields: Possible fields are- problemCode, author, problemName, languagesSupported, sourceSizeLimit,  dateAdded, challengeType, maxTimeLimit, successfulSubmissions, body, totalSubmissions, partialSubmissions, tags.  Multiple fields can be entered using comma.
        :return: InlineResponse2004
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async'):
            return self.contests_contest_code_problems_problem_code_get_with_http_info(problem_code, contest_code, **kwargs)  # noqa: E501
        else:
            (data) = self.contests_contest_code_problems_problem_code_get_with_http_info(problem_code, contest_code, **kwargs)  # noqa: E501
            return data

    def contests_contest_code_problems_problem_code_get_with_http_info(self, problem_code, contest_code, **kwargs):  # noqa: E501
        """Get details of a problem.  # noqa: E501

        Takes problemCode as the parameter and fetches details of that problem.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async=True
        >>> thread = api.contests_contest_code_problems_problem_code_get_with_http_info(problem_code, contest_code, async=True)
        >>> result = thread.get()

        :param async bool
        :param str problem_code: Problem code of the problem, eg. SALARY (required)
        :param str contest_code: Contest code of the contest, eg. PRACTICE, COOK97, JAN17 (required)
        :param str fields: Possible fields are- problemCode, author, problemName, languagesSupported, sourceSizeLimit,  dateAdded, challengeType, maxTimeLimit, successfulSubmissions, body, totalSubmissions, partialSubmissions, tags.  Multiple fields can be entered using comma.
        :return: InlineResponse2004
                 If the method is called asynchronously,
                 returns the request thread.
        """

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

        collection_formats = {}

        path_params = {}
        if 'problem_code' in params:
            path_params['problemCode'] = params['problem_code']  # noqa: E501
        if 'contest_code' in params:
            path_params['contestCode'] = params['contest_code']  # noqa: E501

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

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

        return self.api_client.call_api(
            '/contests/{contestCode}/problems/{problemCode}', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='InlineResponse2004',  # 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)
