"""
    XBIM Flex API v2

    This is the XBIM Flex Swagger service where you can explore the REST API for the platform.  # noqa: E501

    The version of the OpenAPI document: 2.0
    Contact: info@xbim.net
    Generated by: https://openapi-generator.tech
"""


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

from xbim_flex.aim.api_client import ApiClient, Endpoint as _Endpoint
from xbim_flex.aim.model_utils import (  # noqa: F401
    check_allowed_values,
    check_validations,
    date,
    datetime,
    file_type,
    none_type,
    validate_and_convert_types
)
from xbim_flex.aim.model.file_upload_result import FileUploadResult


class DocumentFilesApi(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
        self.document_files_get_file_endpoint = _Endpoint(
            settings={
                'response_type': (file_type,),
                'auth': [
                    'oauth2'
                ],
                'endpoint_path': "/{region}/aim/2.0/{tenantId}/documentfiles/download/{assetId}/{modelId}/{fileId}",
                'operation_id': 'document_files_get_file',
                'http_method': 'GET',
                'servers': None,
            },
            params_map={
                'all': [
                    'asset_id',
                    'model_id',
                    'file_id',
                    'tenant_id',
                    'region',
                ],
                'required': [
                    'asset_id',
                    'model_id',
                    'file_id',
                    'tenant_id',
                    'region',
                ],
                'nullable': [
                ],
                'enum': [
                    'region',
                ],
                'validation': [
                ]
            },
            root_map={
                'validations': {
                },
                'allowed_values': {
                    ('region',): {

                        "UK": "UK",
                        "WESTEUROPE": "WestEurope",
                        "SANDBOX": "Sandbox"
                    },
                },
                'openapi_types': {
                    'asset_id':
                        (int,),
                    'model_id':
                        (int,),
                    'file_id':
                        (str,),
                    'tenant_id':
                        (str,),
                    'region':
                        (str,),
                },
                'attribute_map': {
                    'asset_id': 'assetId',
                    'model_id': 'modelId',
                    'file_id': 'fileId',
                    'tenant_id': 'tenantId',
                    'region': 'region',
                },
                'location_map': {
                    'asset_id': 'path',
                    'model_id': 'path',
                    'file_id': 'path',
                    'tenant_id': 'path',
                    'region': 'path',
                },
                'collection_format_map': {
                }
            },
            headers_map={
                'accept': [
                    'application/octet-stream'
                ],
                'content_type': [],
            },
            api_client=api_client
        )
        self.document_files_upload_single_file_endpoint = _Endpoint(
            settings={
                'response_type': (FileUploadResult,),
                'auth': [
                    'oauth2'
                ],
                'endpoint_path': "/{region}/aim/2.0/{tenantId}/documentfiles/upload",
                'operation_id': 'document_files_upload_single_file',
                'http_method': 'POST',
                'servers': None,
            },
            params_map={
                'all': [
                    'tenant_id',
                    'region',
                    'file',
                    'document_name',
                    'asset_id',
                    'model_id',
                    'external_id',
                ],
                'required': [
                    'tenant_id',
                    'region',
                    'file',
                    'document_name',
                    'asset_id',
                    'model_id',
                ],
                'nullable': [
                ],
                'enum': [
                    'region',
                ],
                'validation': [
                ]
            },
            root_map={
                'validations': {
                },
                'allowed_values': {
                    ('region',): {

                        "UK": "UK",
                        "WESTEUROPE": "WestEurope",
                        "SANDBOX": "Sandbox"
                    },
                },
                'openapi_types': {
                    'tenant_id':
                        (str,),
                    'region':
                        (str,),
                    'file':
                        (file_type,),
                    'document_name':
                        (str,),
                    'asset_id':
                        (int,),
                    'model_id':
                        (int,),
                    'external_id':
                        (str,),
                },
                'attribute_map': {
                    'tenant_id': 'tenantId',
                    'region': 'region',
                    'file': 'file',
                    'document_name': 'documentName',
                    'asset_id': 'assetId',
                    'model_id': 'modelId',
                    'external_id': 'externalId',
                },
                'location_map': {
                    'tenant_id': 'path',
                    'region': 'path',
                    'file': 'form',
                    'document_name': 'form',
                    'asset_id': 'form',
                    'model_id': 'form',
                    'external_id': 'form',
                },
                'collection_format_map': {
                }
            },
            headers_map={
                'accept': [
                    'application/json',
                    'text/json',
                    'application/xml',
                    'text/xml'
                ],
                'content_type': [
                    'multipart/form-data'
                ]
            },
            api_client=api_client
        )

    def document_files_get_file(
        self,
        asset_id,
        model_id,
        file_id,
        tenant_id,
        region="UK",
        **kwargs
    ):
        """Get DocumentFiles file  # noqa: E501

        <span style='font-size: 17px;'>Summary</span><br/>Downloads binary file related to asset and model. Return Type: string <br/><br/>    # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True

        >>> thread = api.document_files_get_file(asset_id, model_id, file_id, tenant_id, region="UK", async_req=True)
        >>> result = thread.get()

        Args:
            asset_id (int): Asset ID
            model_id (int): Model ID
            file_id (str): File ID
            tenant_id (str): The unique Tenant ID (UUID or Identifier string)
            region (str): The data center region the data resides in. defaults to "UK", must be one of ["UK"]

        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 (int/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:
            file_type
                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['asset_id'] = \
            asset_id
        kwargs['model_id'] = \
            model_id
        kwargs['file_id'] = \
            file_id
        kwargs['tenant_id'] = \
            tenant_id
        kwargs['region'] = \
            region
        return self.document_files_get_file_endpoint.call_with_http_info(**kwargs)

    def document_files_upload_single_file(
        self,
        tenant_id,
        file,
        document_name,
        asset_id,
        model_id,
        region="UK",
        **kwargs
    ):
        """Post DocumentFiles upload single file  # noqa: E501

        <span style='font-size: 17px;'>Summary</span><br/>Uploads a document file related to a specific model. The document will be associated with the asset and model provided in the Form data parameters. Return Type: FileUploadResult <br/><br/>    # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True

        >>> thread = api.document_files_upload_single_file(tenant_id, file, document_name, asset_id, model_id, region="UK", async_req=True)
        >>> result = thread.get()

        Args:
            tenant_id (str): The unique Tenant ID (UUID or Identifier string)
            file (file_type): An arbitrary document which will get associated to the model or its parts.
            document_name (str): The name of the Document
            asset_id (int): Asset which should contain the document
            model_id (int): Asset model which should contain the document
            region (str): The data center region the data resides in. defaults to "UK", must be one of ["UK"]

        Keyword Args:
            external_id (str): External identity of the document. This will be used for versioning.. [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 (int/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:
            FileUploadResult
                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['tenant_id'] = \
            tenant_id
        kwargs['region'] = \
            region
        kwargs['file'] = \
            file
        kwargs['document_name'] = \
            document_name
        kwargs['asset_id'] = \
            asset_id
        kwargs['model_id'] = \
            model_id
        return self.document_files_upload_single_file_endpoint.call_with_http_info(**kwargs)

