"""
    Ingest API v1

    The `ingestion` service provides the way to submit data to stream layers using REST API.  # noqa: E501

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


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

from here_data_ingest_v1_client.api_client import ApiClient, Endpoint as _Endpoint
from here_data_ingest_v1_client.model_utils import (  # noqa: F401
    check_allowed_values,
    check_validations,
    date,
    datetime,
    file_type,
    none_type,
    validate_and_convert_types
)
from here_data_ingest_v1_client.model.response400 import Response400
from here_data_ingest_v1_client.model.response404 import Response404
from here_data_ingest_v1_client.model.response413 import Response413
from here_data_ingest_v1_client.model.response415 import Response415
from here_data_ingest_v1_client.model.response500 import Response500
from here_data_ingest_v1_client.model.response_ok import ResponseOk
from here_data_ingest_v1_client.model.response_ok_single import ResponseOkSingle


class IngestionApi(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 __ingest_data(
            self,
            layer_id,
            byte_array,
            **kwargs
        ):
            """Endpoint for ingesting generic data  # noqa: E501

            Sends streaming data to a specified layer in the Open Location Platform.  # noqa: E501
            This method makes a synchronous HTTP request by default. To make an
            asynchronous HTTP request, please pass async_req=True

            >>> thread = api.ingest_data(layer_id, byte_array, async_req=True)
            >>> result = thread.get()

            Args:
                layer_id (str): The ID of the layer where you want the data ingested.
                byte_array (file_type): A byte array of data to send to the Open Location Platform for ingestion. The maximum size is 20 MB. Decode the example from base64 before using.

            Keyword Args:
                x_here_checksum (str): A base64 encoded SHA-256 hash you can provide for validation against the calculated value on the request body hash. This verifies the integrity of your request and prevents modification by a third party.It will be created by the service if not provided. A SHA-256 hash consists of 256 bits or 64 chars.. [optional]
                x_here_trace_id (str): A unique message ID, such as a UUID. This can be included in the request if you want to use an ID that you define. If you do not include an ID, one will be generated during ingestion and included in the response. You can use this ID to track your request and identify the message in the catalog.. [optional]
                x_here_message_key (str): A unique message ID, such as a UUID. This can be included in the request if you want to use an ID that you define. If you do not include an ID, X-HERE-TraceId will be used instead. You can use this ID to specify the partition for the message in the data catalog.. [optional]
                billing_tag (str): Optional billing tag provided by customer. It will be used in grouping of billing records.. [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:
                ResponseOkSingle
                    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['layer_id'] = \
                layer_id
            kwargs['byte_array'] = \
                byte_array
            return self.call_with_http_info(**kwargs)

        self.ingest_data = _Endpoint(
            settings={
                'response_type': (ResponseOkSingle,),
                'auth': [
                    'Bearer'
                ],
                'endpoint_path': '/layers/{layerId}',
                'operation_id': 'ingest_data',
                'http_method': 'POST',
                'servers': None,
            },
            params_map={
                'all': [
                    'layer_id',
                    'byte_array',
                    'x_here_checksum',
                    'x_here_trace_id',
                    'x_here_message_key',
                    'billing_tag',
                ],
                'required': [
                    'layer_id',
                    'byte_array',
                ],
                'nullable': [
                ],
                'enum': [
                ],
                'validation': [
                ]
            },
            root_map={
                'validations': {
                },
                'allowed_values': {
                },
                'openapi_types': {
                    'layer_id':
                        (str,),
                    'byte_array':
                        (file_type,),
                    'x_here_checksum':
                        (str,),
                    'x_here_trace_id':
                        (str,),
                    'x_here_message_key':
                        (str,),
                    'billing_tag':
                        (str,),
                },
                'attribute_map': {
                    'layer_id': 'layerId',
                    'x_here_checksum': 'X-HERE-Checksum',
                    'x_here_trace_id': 'X-HERE-TraceId',
                    'x_here_message_key': 'X-HERE-Message-Key',
                    'billing_tag': 'billingTag',
                },
                'location_map': {
                    'layer_id': 'path',
                    'byte_array': 'body',
                    'x_here_checksum': 'header',
                    'x_here_trace_id': 'header',
                    'x_here_message_key': 'header',
                    'billing_tag': 'query',
                },
                'collection_format_map': {
                }
            },
            headers_map={
                'accept': [
                    'application/json'
                ],
                'content_type': [
                    'application/octet-stream'
                ]
            },
            api_client=api_client,
            callable=__ingest_data
        )

        def __ingest_sdii(
            self,
            layer_id,
            byte_array,
            **kwargs
        ):
            """Send a list of SDII messages to a stream layer  # noqa: E501

            Consumes individual SDII messages and SDII MessageLists. The endpoint automatically breaks SDII MessageLists down and stores the data as individual SDII messages. Note that this endpoint does not support compression. If you are sending data to stream layer that has compression enabled, you must use the `/layers/<layerID>` endpoint and all compression and decompression must be handled by your application.  # noqa: E501
            This method makes a synchronous HTTP request by default. To make an
            asynchronous HTTP request, please pass async_req=True

            >>> thread = api.ingest_sdii(layer_id, byte_array, async_req=True)
            >>> result = thread.get()

            Args:
                layer_id (str): The ID of the layer where you want the data ingested.
                byte_array (file_type): A byte array of data in SDII MessageList protobuf format to send to the Open Location Platform for ingestion. The maximum size is 20 MB. Decode the example from base64 before using.

            Keyword Args:
                x_here_checksum (str): A base64 encoded SHA-256 hash you can provide for validation against the calculated value on the request body hash. This verifies the integrity of your request and prevents modification by a third party.It will be created by the service if not provided. A SHA-256 hash consists of 256 bits or 64 chars.. [optional]
                x_here_trace_id (str): A unique message ID, such as a UUID. This can be included in the request if you want to use an ID that you define. If you do not include an ID, one will be generated during ingestion and included in the response. You can use this ID to track your request and identify the message in the catalog.. [optional]
                x_here_message_key (str): A unique message ID, such as a UUID. This can be included in the request if you want to use an ID that you define. If you do not include an ID, X-HERE-TraceId will be used instead. You can use this ID to specify the partition for the message in the data catalog.. [optional]
                billing_tag (str): Optional billing tag provided by customer. It will be used in grouping of billing records.. [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:
                ResponseOk
                    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['layer_id'] = \
                layer_id
            kwargs['byte_array'] = \
                byte_array
            return self.call_with_http_info(**kwargs)

        self.ingest_sdii = _Endpoint(
            settings={
                'response_type': (ResponseOk,),
                'auth': [
                    'Bearer'
                ],
                'endpoint_path': '/layers/{layerId}/sdiiMessageList',
                'operation_id': 'ingest_sdii',
                'http_method': 'POST',
                'servers': None,
            },
            params_map={
                'all': [
                    'layer_id',
                    'byte_array',
                    'x_here_checksum',
                    'x_here_trace_id',
                    'x_here_message_key',
                    'billing_tag',
                ],
                'required': [
                    'layer_id',
                    'byte_array',
                ],
                'nullable': [
                ],
                'enum': [
                ],
                'validation': [
                ]
            },
            root_map={
                'validations': {
                },
                'allowed_values': {
                },
                'openapi_types': {
                    'layer_id':
                        (str,),
                    'byte_array':
                        (file_type,),
                    'x_here_checksum':
                        (str,),
                    'x_here_trace_id':
                        (str,),
                    'x_here_message_key':
                        (str,),
                    'billing_tag':
                        (str,),
                },
                'attribute_map': {
                    'layer_id': 'layerId',
                    'x_here_checksum': 'X-HERE-Checksum',
                    'x_here_trace_id': 'X-HERE-TraceId',
                    'x_here_message_key': 'X-HERE-Message-Key',
                    'billing_tag': 'billingTag',
                },
                'location_map': {
                    'layer_id': 'path',
                    'byte_array': 'body',
                    'x_here_checksum': 'header',
                    'x_here_trace_id': 'header',
                    'x_here_message_key': 'header',
                    'billing_tag': 'query',
                },
                'collection_format_map': {
                }
            },
            headers_map={
                'accept': [
                    'application/json'
                ],
                'content_type': [
                    'application/x-protobuf'
                ]
            },
            api_client=api_client,
            callable=__ingest_sdii
        )
