# coding: utf-8

"""
    result-analysis-service

    No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)  # noqa: E501

    The version of the OpenAPI document: 1.0.0
    Generated by: https://openapi-generator.tech
"""


from __future__ import absolute_import

import re  # noqa: F401

# python 2 and python 3 compatibility library
import six

from dhicn_result_analysis_service.api_client import ApiClient
from dhicn_result_analysis_service.exceptions import (  # noqa: F401
    ApiTypeError,
    ApiValueError
)


class RainLogApi(object):
    """NOTE: This class is auto generated by OpenAPI Generator
    Ref: https://openapi-generator.tech

    Do not edit the class manually.
    """

    def __init__(self, api_client=None):
        if api_client is None:
            api_client = ApiClient()
        self.api_client = api_client

    def api_v1_result_rain_get_get(self, **kwargs):  # noqa: E501
        """根据ID查询降雨记录 Get rainfall log by id  # noqa: E501

        根据ID查询降雨记录，每一场降雨记录都对应于若干个连续的自动预报方案 Query rainfall records by id. Each rainfall record corresponds to several continuous auto forecast scenarios.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.api_v1_result_rain_get_get(async_req=True)
        >>> result = thread.get()

        :param async_req bool: execute request asynchronously
        :param str rain_id:
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :return: QueryRainOutput
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        return self.api_v1_result_rain_get_get_with_http_info(**kwargs)  # noqa: E501

    def api_v1_result_rain_get_get_with_http_info(self, **kwargs):  # noqa: E501
        """根据ID查询降雨记录 Get rainfall log by id  # noqa: E501

        根据ID查询降雨记录，每一场降雨记录都对应于若干个连续的自动预报方案 Query rainfall records by id. Each rainfall record corresponds to several continuous auto forecast scenarios.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.api_v1_result_rain_get_get_with_http_info(async_req=True)
        >>> result = thread.get()

        :param async_req bool: execute request asynchronously
        :param str rain_id:
        :param _return_http_data_only: response data without head status code
                                       and headers
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :return: tuple(QueryRainOutput, status_code(int), headers(HTTPHeaderDict))
                 If the method is called asynchronously,
                 returns the request thread.
        """

        local_var_params = locals()

        all_params = [
            'rain_id'
        ]
        all_params.extend(
            [
                'async_req',
                '_return_http_data_only',
                '_preload_content',
                '_request_timeout'
            ]
        )

        for key, val in six.iteritems(local_var_params['kwargs']):
            if key not in all_params:
                raise ApiTypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method api_v1_result_rain_get_get" % key
                )
            local_var_params[key] = val
        del local_var_params['kwargs']

        collection_formats = {}

        path_params = {}

        query_params = []
        if 'rain_id' in local_var_params and local_var_params['rain_id'] is not None:  # noqa: E501
            query_params.append(('rainId', local_var_params['rain_id']))  # 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(
            '/api/v1/result/rain/get', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='QueryRainOutput',  # noqa: E501
            auth_settings=auth_settings,
            async_req=local_var_params.get('async_req'),
            _return_http_data_only=local_var_params.get('_return_http_data_only'),  # noqa: E501
            _preload_content=local_var_params.get('_preload_content', True),
            _request_timeout=local_var_params.get('_request_timeout'),
            collection_formats=collection_formats)

    def api_v1_result_rain_list_by_single_time_get(self, rain_time, **kwargs):  # noqa: E501
        """查询降雨记录 Get rainfall record by time  # noqa: E501

        按时间查询降雨记录，只有时间范围包含了查询时刻的降雨记录会被返回，同时也会返回每个降雨记录对应的方案ID列表（每一场降雨记录都对应于若干个连续的自动预报方案） Query rainfall records by time, only rainfall record contain the query time will be returned, together with their associated scenario Ids.  Each rainfall record corresponds to several continuous auto forecast scenarios.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.api_v1_result_rain_list_by_single_time_get(rain_time, async_req=True)
        >>> result = thread.get()

        :param async_req bool: execute request asynchronously
        :param str rain_time: 查询时刻 time (required)
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :return: list[QueryRainOutput]
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        return self.api_v1_result_rain_list_by_single_time_get_with_http_info(rain_time, **kwargs)  # noqa: E501

    def api_v1_result_rain_list_by_single_time_get_with_http_info(self, rain_time, **kwargs):  # noqa: E501
        """查询降雨记录 Get rainfall record by time  # noqa: E501

        按时间查询降雨记录，只有时间范围包含了查询时刻的降雨记录会被返回，同时也会返回每个降雨记录对应的方案ID列表（每一场降雨记录都对应于若干个连续的自动预报方案） Query rainfall records by time, only rainfall record contain the query time will be returned, together with their associated scenario Ids.  Each rainfall record corresponds to several continuous auto forecast scenarios.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.api_v1_result_rain_list_by_single_time_get_with_http_info(rain_time, async_req=True)
        >>> result = thread.get()

        :param async_req bool: execute request asynchronously
        :param str rain_time: 查询时刻 time (required)
        :param _return_http_data_only: response data without head status code
                                       and headers
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :return: tuple(list[QueryRainOutput], status_code(int), headers(HTTPHeaderDict))
                 If the method is called asynchronously,
                 returns the request thread.
        """

        local_var_params = locals()

        all_params = [
            'rain_time'
        ]
        all_params.extend(
            [
                'async_req',
                '_return_http_data_only',
                '_preload_content',
                '_request_timeout'
            ]
        )

        for key, val in six.iteritems(local_var_params['kwargs']):
            if key not in all_params:
                raise ApiTypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method api_v1_result_rain_list_by_single_time_get" % key
                )
            local_var_params[key] = val
        del local_var_params['kwargs']
        # verify the required parameter 'rain_time' is set
        if self.api_client.client_side_validation and ('rain_time' not in local_var_params or  # noqa: E501
                                                        local_var_params['rain_time'] is None):  # noqa: E501
            raise ApiValueError("Missing the required parameter `rain_time` when calling `api_v1_result_rain_list_by_single_time_get`")  # noqa: E501

        collection_formats = {}

        path_params = {}

        query_params = []
        if 'rain_time' in local_var_params and local_var_params['rain_time'] is not None:  # noqa: E501
            query_params.append(('RainTime', local_var_params['rain_time']))  # 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(
            '/api/v1/result/rain/list-by-single-time', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='list[QueryRainOutput]',  # noqa: E501
            auth_settings=auth_settings,
            async_req=local_var_params.get('async_req'),
            _return_http_data_only=local_var_params.get('_return_http_data_only'),  # noqa: E501
            _preload_content=local_var_params.get('_preload_content', True),
            _request_timeout=local_var_params.get('_request_timeout'),
            collection_formats=collection_formats)

    def api_v1_result_rain_list_get(self, start_time, end_time, **kwargs):  # noqa: E501
        """查询降雨的记录 Query rainfall records  # noqa: E501

        按时间查询降雨记录，只有在StartTime和EndTime之间开始的降雨记录会被返回，同时也会返回每个降雨记录对应的方案ID列表（每一场降雨记录都对应于若干个连续的自动预报方案） Query rainfall records by time, only rainfall records start between StartTime and EndTime will be returned, together with their associated scenario Ids. Each rainfall record corresponds to several continuous auto forecast scenarios.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.api_v1_result_rain_list_get(start_time, end_time, async_req=True)
        >>> result = thread.get()

        :param async_req bool: execute request asynchronously
        :param str start_time: 查询的开始时刻 query start time (required)
        :param str end_time: 查询的结束时刻 query end time (required)
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :return: list[QueryRainOutput]
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        return self.api_v1_result_rain_list_get_with_http_info(start_time, end_time, **kwargs)  # noqa: E501

    def api_v1_result_rain_list_get_with_http_info(self, start_time, end_time, **kwargs):  # noqa: E501
        """查询降雨的记录 Query rainfall records  # noqa: E501

        按时间查询降雨记录，只有在StartTime和EndTime之间开始的降雨记录会被返回，同时也会返回每个降雨记录对应的方案ID列表（每一场降雨记录都对应于若干个连续的自动预报方案） Query rainfall records by time, only rainfall records start between StartTime and EndTime will be returned, together with their associated scenario Ids. Each rainfall record corresponds to several continuous auto forecast scenarios.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.api_v1_result_rain_list_get_with_http_info(start_time, end_time, async_req=True)
        >>> result = thread.get()

        :param async_req bool: execute request asynchronously
        :param str start_time: 查询的开始时刻 query start time (required)
        :param str end_time: 查询的结束时刻 query end time (required)
        :param _return_http_data_only: response data without head status code
                                       and headers
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :return: tuple(list[QueryRainOutput], status_code(int), headers(HTTPHeaderDict))
                 If the method is called asynchronously,
                 returns the request thread.
        """

        local_var_params = locals()

        all_params = [
            'start_time',
            'end_time'
        ]
        all_params.extend(
            [
                'async_req',
                '_return_http_data_only',
                '_preload_content',
                '_request_timeout'
            ]
        )

        for key, val in six.iteritems(local_var_params['kwargs']):
            if key not in all_params:
                raise ApiTypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method api_v1_result_rain_list_get" % key
                )
            local_var_params[key] = val
        del local_var_params['kwargs']
        # verify the required parameter 'start_time' is set
        if self.api_client.client_side_validation and ('start_time' not in local_var_params or  # noqa: E501
                                                        local_var_params['start_time'] is None):  # noqa: E501
            raise ApiValueError("Missing the required parameter `start_time` when calling `api_v1_result_rain_list_get`")  # noqa: E501
        # verify the required parameter 'end_time' is set
        if self.api_client.client_side_validation and ('end_time' not in local_var_params or  # noqa: E501
                                                        local_var_params['end_time'] is None):  # noqa: E501
            raise ApiValueError("Missing the required parameter `end_time` when calling `api_v1_result_rain_list_get`")  # noqa: E501

        collection_formats = {}

        path_params = {}

        query_params = []
        if 'start_time' in local_var_params and local_var_params['start_time'] is not None:  # noqa: E501
            query_params.append(('StartTime', local_var_params['start_time']))  # noqa: E501
        if 'end_time' in local_var_params and local_var_params['end_time'] is not None:  # noqa: E501
            query_params.append(('EndTime', local_var_params['end_time']))  # 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(
            '/api/v1/result/rain/list', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='list[QueryRainOutput]',  # noqa: E501
            auth_settings=auth_settings,
            async_req=local_var_params.get('async_req'),
            _return_http_data_only=local_var_params.get('_return_http_data_only'),  # noqa: E501
            _preload_content=local_var_params.get('_preload_content', True),
            _request_timeout=local_var_params.get('_request_timeout'),
            collection_formats=collection_formats)
