"""
    WhyLabs API client

    WhyLabs API that enables end-to-end AI observability  # noqa: E501

    The version of the OpenAPI document: 0.1
    Contact: support@whylabs.ai
    Generated by: https://openapi-generator.tech
"""


import re  # noqa: F401
import sys  # noqa: F401

from whylabs_client.api_client import ApiClient, Endpoint as _Endpoint
from whylabs_client.model_utils import (  # noqa: F401
    check_allowed_values,
    check_validations,
    date,
    datetime,
    file_type,
    none_type,
    validate_and_convert_types
)
from whylabs_client.model.async_log_response import AsyncLogResponse
from whylabs_client.model.log_async_request import LogAsyncRequest
from whylabs_client.model.log_reference_request import LogReferenceRequest
from whylabs_client.model.log_reference_response import LogReferenceResponse
from whylabs_client.model.log_response import LogResponse
from whylabs_client.model.segment_tag import SegmentTag


class LogApi(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 __log(
            self,
            org_id,
            model_id,
            **kwargs
        ):
            """Log a dataset profile entry to the backend  # noqa: E501

            This method returns a [LogResponse] object if it succeeds  # noqa: E501
            This method makes a synchronous HTTP request by default. To make an
            asynchronous HTTP request, please pass async_req=True

            >>> thread = api.log(org_id, model_id, async_req=True)
            >>> result = thread.get()

            Args:
                org_id (str): Your company's unique organization ID
                model_id (str): The unique model ID in your company.

            Keyword Args:
                dataset_timestamp (int, none_type): The dataset timestamp associated with the entry. Not required. However, this will  override the whylogs dataset timestamp if specified. [optional]
                segment_tags ([SegmentTag], none_type): The segment associated with the log entry. Not required if segment tags are specified in whylogs. [optional]
                segment_tags_json (str, none_type): [optional]
                file (file_type): The Dataset Profile log entry. [optional]
                _return_http_data_only (bool): response data without head status
                    code and headers. Default is True.
                _preload_content (bool): if False, the urllib3.HTTPResponse object
                    will be returned without reading/decoding response data.
                    Default is True.
                _request_timeout (float/tuple): 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.
                    Default is None.
                _check_input_type (bool): specifies if type checking
                    should be done one the data sent to the server.
                    Default is True.
                _check_return_type (bool): specifies if type checking
                    should be done one the data received from the server.
                    Default is True.
                _host_index (int/None): specifies the index of the server
                    that we want to use.
                    Default is read from the configuration.
                async_req (bool): execute request asynchronously

            Returns:
                LogResponse
                    If the method is called asynchronously, returns the request
                    thread.
            """
            kwargs['async_req'] = kwargs.get(
                'async_req', False
            )
            kwargs['_return_http_data_only'] = kwargs.get(
                '_return_http_data_only', True
            )
            kwargs['_preload_content'] = kwargs.get(
                '_preload_content', True
            )
            kwargs['_request_timeout'] = kwargs.get(
                '_request_timeout', None
            )
            kwargs['_check_input_type'] = kwargs.get(
                '_check_input_type', True
            )
            kwargs['_check_return_type'] = kwargs.get(
                '_check_return_type', True
            )
            kwargs['_host_index'] = kwargs.get('_host_index')
            kwargs['org_id'] = \
                org_id
            kwargs['model_id'] = \
                model_id
            return self.call_with_http_info(**kwargs)

        self.log = _Endpoint(
            settings={
                'response_type': (LogResponse,),
                'auth': [
                    'ApiKeyAuth'
                ],
                'endpoint_path': '/v0/organizations/{org_id}/log',
                'operation_id': 'log',
                'http_method': 'POST',
                'servers': None,
            },
            params_map={
                'all': [
                    'org_id',
                    'model_id',
                    'dataset_timestamp',
                    'segment_tags',
                    'segment_tags_json',
                    'file',
                ],
                'required': [
                    'org_id',
                    'model_id',
                ],
                'nullable': [
                    'dataset_timestamp',
                    'segment_tags',
                    'segment_tags_json',
                ],
                'enum': [
                ],
                'validation': [
                ]
            },
            root_map={
                'validations': {
                },
                'allowed_values': {
                },
                'openapi_types': {
                    'org_id':
                        (str,),
                    'model_id':
                        (str,),
                    'dataset_timestamp':
                        (int, none_type,),
                    'segment_tags':
                        ([SegmentTag], none_type,),
                    'segment_tags_json':
                        (str, none_type,),
                    'file':
                        (file_type,),
                },
                'attribute_map': {
                    'org_id': 'org_id',
                    'model_id': 'model_id',
                    'dataset_timestamp': 'dataset_timestamp',
                    'segment_tags': 'segment_tags',
                    'segment_tags_json': 'segment_tags_json',
                    'file': 'file',
                },
                'location_map': {
                    'org_id': 'path',
                    'model_id': 'query',
                    'dataset_timestamp': 'query',
                    'segment_tags': 'query',
                    'segment_tags_json': 'query',
                    'file': 'form',
                },
                'collection_format_map': {
                    'segment_tags': 'multi',
                }
            },
            headers_map={
                'accept': [
                    'application/json'
                ],
                'content_type': [
                    'multipart/form-data'
                ]
            },
            api_client=api_client,
            callable=__log
        )

        def __log_async(
            self,
            org_id,
            dataset_id,
            log_async_request,
            **kwargs
        ):
            """Like /log, except this api doesn't take the actual profile content. It returns an upload link that can be used to upload the profile to.  # noqa: E501

            Like /log, except this api doesn't take the actual profile content. It returns an upload link that can be used to upload the profile to.  # noqa: E501
            This method makes a synchronous HTTP request by default. To make an
            asynchronous HTTP request, please pass async_req=True

            >>> thread = api.log_async(org_id, dataset_id, log_async_request, async_req=True)
            >>> result = thread.get()

            Args:
                org_id (str):
                dataset_id (str):
                log_async_request (LogAsyncRequest):

            Keyword Args:
                _return_http_data_only (bool): response data without head status
                    code and headers. Default is True.
                _preload_content (bool): if False, the urllib3.HTTPResponse object
                    will be returned without reading/decoding response data.
                    Default is True.
                _request_timeout (float/tuple): 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.
                    Default is None.
                _check_input_type (bool): specifies if type checking
                    should be done one the data sent to the server.
                    Default is True.
                _check_return_type (bool): specifies if type checking
                    should be done one the data received from the server.
                    Default is True.
                _host_index (int/None): specifies the index of the server
                    that we want to use.
                    Default is read from the configuration.
                async_req (bool): execute request asynchronously

            Returns:
                AsyncLogResponse
                    If the method is called asynchronously, returns the request
                    thread.
            """
            kwargs['async_req'] = kwargs.get(
                'async_req', False
            )
            kwargs['_return_http_data_only'] = kwargs.get(
                '_return_http_data_only', True
            )
            kwargs['_preload_content'] = kwargs.get(
                '_preload_content', True
            )
            kwargs['_request_timeout'] = kwargs.get(
                '_request_timeout', None
            )
            kwargs['_check_input_type'] = kwargs.get(
                '_check_input_type', True
            )
            kwargs['_check_return_type'] = kwargs.get(
                '_check_return_type', True
            )
            kwargs['_host_index'] = kwargs.get('_host_index')
            kwargs['org_id'] = \
                org_id
            kwargs['dataset_id'] = \
                dataset_id
            kwargs['log_async_request'] = \
                log_async_request
            return self.call_with_http_info(**kwargs)

        self.log_async = _Endpoint(
            settings={
                'response_type': (AsyncLogResponse,),
                'auth': [
                    'ApiKeyAuth'
                ],
                'endpoint_path': '/v0/organizations/{org_id}/log/async/{dataset_id}',
                'operation_id': 'log_async',
                'http_method': 'POST',
                'servers': None,
            },
            params_map={
                'all': [
                    'org_id',
                    'dataset_id',
                    'log_async_request',
                ],
                'required': [
                    'org_id',
                    'dataset_id',
                    'log_async_request',
                ],
                'nullable': [
                ],
                'enum': [
                ],
                'validation': [
                ]
            },
            root_map={
                'validations': {
                },
                'allowed_values': {
                },
                'openapi_types': {
                    'org_id':
                        (str,),
                    'dataset_id':
                        (str,),
                    'log_async_request':
                        (LogAsyncRequest,),
                },
                'attribute_map': {
                    'org_id': 'org_id',
                    'dataset_id': 'dataset_id',
                },
                'location_map': {
                    'org_id': 'path',
                    'dataset_id': 'path',
                    'log_async_request': 'body',
                },
                'collection_format_map': {
                }
            },
            headers_map={
                'accept': [
                    'application/json'
                ],
                'content_type': [
                    'application/json'
                ]
            },
            api_client=api_client,
            callable=__log_async
        )

        def __log_reference(
            self,
            org_id,
            model_id,
            log_reference_request,
            **kwargs
        ):
            """Returns a presigned URL for uploading the reference profile to.  # noqa: E501

            Reference profiles can be used for.  # noqa: E501
            This method makes a synchronous HTTP request by default. To make an
            asynchronous HTTP request, please pass async_req=True

            >>> thread = api.log_reference(org_id, model_id, log_reference_request, async_req=True)
            >>> result = thread.get()

            Args:
                org_id (str):
                model_id (str):
                log_reference_request (LogReferenceRequest):

            Keyword Args:
                _return_http_data_only (bool): response data without head status
                    code and headers. Default is True.
                _preload_content (bool): if False, the urllib3.HTTPResponse object
                    will be returned without reading/decoding response data.
                    Default is True.
                _request_timeout (float/tuple): 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.
                    Default is None.
                _check_input_type (bool): specifies if type checking
                    should be done one the data sent to the server.
                    Default is True.
                _check_return_type (bool): specifies if type checking
                    should be done one the data received from the server.
                    Default is True.
                _host_index (int/None): specifies the index of the server
                    that we want to use.
                    Default is read from the configuration.
                async_req (bool): execute request asynchronously

            Returns:
                LogReferenceResponse
                    If the method is called asynchronously, returns the request
                    thread.
            """
            kwargs['async_req'] = kwargs.get(
                'async_req', False
            )
            kwargs['_return_http_data_only'] = kwargs.get(
                '_return_http_data_only', True
            )
            kwargs['_preload_content'] = kwargs.get(
                '_preload_content', True
            )
            kwargs['_request_timeout'] = kwargs.get(
                '_request_timeout', None
            )
            kwargs['_check_input_type'] = kwargs.get(
                '_check_input_type', True
            )
            kwargs['_check_return_type'] = kwargs.get(
                '_check_return_type', True
            )
            kwargs['_host_index'] = kwargs.get('_host_index')
            kwargs['org_id'] = \
                org_id
            kwargs['model_id'] = \
                model_id
            kwargs['log_reference_request'] = \
                log_reference_request
            return self.call_with_http_info(**kwargs)

        self.log_reference = _Endpoint(
            settings={
                'response_type': (LogReferenceResponse,),
                'auth': [
                    'ApiKeyAuth'
                ],
                'endpoint_path': '/v0/organizations/{org_id}/log/reference/{model_id}',
                'operation_id': 'log_reference',
                'http_method': 'POST',
                'servers': None,
            },
            params_map={
                'all': [
                    'org_id',
                    'model_id',
                    'log_reference_request',
                ],
                'required': [
                    'org_id',
                    'model_id',
                    'log_reference_request',
                ],
                'nullable': [
                ],
                'enum': [
                ],
                'validation': [
                ]
            },
            root_map={
                'validations': {
                },
                'allowed_values': {
                },
                'openapi_types': {
                    'org_id':
                        (str,),
                    'model_id':
                        (str,),
                    'log_reference_request':
                        (LogReferenceRequest,),
                },
                'attribute_map': {
                    'org_id': 'org_id',
                    'model_id': 'model_id',
                },
                'location_map': {
                    'org_id': 'path',
                    'model_id': 'path',
                    'log_reference_request': 'body',
                },
                'collection_format_map': {
                }
            },
            headers_map={
                'accept': [
                    'application/json'
                ],
                'content_type': [
                    'application/json'
                ]
            },
            api_client=api_client,
            callable=__log_reference
        )
