"""
    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.application import Application
from xbim_flex.aim.model.o_data_list_response_of_application import ODataListResponseOfApplication


class ApplicationsApi(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.applications_get_by_tenantid_endpoint = _Endpoint(
            settings={
                'response_type': (ODataListResponseOfApplication,),
                'auth': [
                    'oauth2'
                ],
                'endpoint_path': "/{region}/aim/2.0/{tenantId}/Applications",
                'operation_id': 'applications_get_by_tenantid',
                'http_method': 'GET',
                'servers': None,
            },
            params_map={
                'all': [
                    'tenant_id',
                    'region',
                    'expand',
                    'filter',
                    'select',
                    'orderby',
                    'top',
                    'skip',
                    'count',
                ],
                'required': [
                    'tenant_id',
                    'region',
                ],
                'nullable': [
                ],
                'enum': [
                    'region',
                ],
                'validation': [
                ]
            },
            root_map={
                'validations': {
                },
                'allowed_values': {
                    ('region',): {

                        "UK": "UK",
                        "WESTEUROPE": "WestEurope",
                        "SANDBOX": "Sandbox"
                    },
                },
                'openapi_types': {
                    'tenant_id':
                        (str,),
                    'region':
                        (str,),
                    'expand':
                        (str,),
                    'filter':
                        (str,),
                    'select':
                        (str,),
                    'orderby':
                        (str,),
                    'top':
                        (int,),
                    'skip':
                        (int,),
                    'count':
                        (bool,),
                },
                'attribute_map': {
                    'tenant_id': 'tenantId',
                    'region': 'region',
                    'expand': '$expand',
                    'filter': '$filter',
                    'select': '$select',
                    'orderby': '$orderby',
                    'top': '$top',
                    'skip': '$skip',
                    'count': '$count',
                },
                'location_map': {
                    'tenant_id': 'path',
                    'region': 'path',
                    'expand': 'query',
                    'filter': 'query',
                    'select': 'query',
                    'orderby': 'query',
                    'top': 'query',
                    'skip': 'query',
                    'count': 'query',
                },
                'collection_format_map': {
                }
            },
            headers_map={
                'accept': [
                    'application/json',
                    'application/json;odata.metadata=none',
                    'application/json;odata.metadata=minimal',
                    'application/json;odata.metadata=full',
                    'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
                ],
                'content_type': [],
            },
            api_client=api_client
        )
        self.applications_get_single_by_applicationid_and_tenantid_endpoint = _Endpoint(
            settings={
                'response_type': (Application,),
                'auth': [
                    'oauth2'
                ],
                'endpoint_path': "/{region}/aim/2.0/{tenantId}/Applications({ApplicationId})",
                'operation_id': 'applications_get_single_by_applicationid_and_tenantid',
                'http_method': 'GET',
                'servers': None,
            },
            params_map={
                'all': [
                    'application_id',
                    'tenant_id',
                    'region',
                    'expand',
                    'select',
                ],
                'required': [
                    'application_id',
                    'tenant_id',
                    'region',
                ],
                'nullable': [
                ],
                'enum': [
                    'region',
                ],
                'validation': [
                ]
            },
            root_map={
                'validations': {
                },
                'allowed_values': {
                    ('region',): {

                        "UK": "UK",
                        "WESTEUROPE": "WestEurope",
                        "SANDBOX": "Sandbox"
                    },
                },
                'openapi_types': {
                    'application_id':
                        (int,),
                    'tenant_id':
                        (str,),
                    'region':
                        (str,),
                    'expand':
                        (str,),
                    'select':
                        (str,),
                },
                'attribute_map': {
                    'application_id': 'ApplicationId',
                    'tenant_id': 'tenantId',
                    'region': 'region',
                    'expand': '$expand',
                    'select': '$select',
                },
                'location_map': {
                    'application_id': 'path',
                    'tenant_id': 'path',
                    'region': 'path',
                    'expand': 'query',
                    'select': 'query',
                },
                'collection_format_map': {
                }
            },
            headers_map={
                'accept': [
                    'application/json',
                    'application/json;odata.metadata=none',
                    'application/json;odata.metadata=minimal',
                    'application/json;odata.metadata=full'
                ],
                'content_type': [],
            },
            api_client=api_client
        )

    def applications_get_by_tenantid(
        self,
        tenant_id,
        region="UK",
        **kwargs
    ):
        """Get Applications by tenantid  # noqa: E501

        <span style='font-size: 17px;'>Summary</span><br/>Returns the EntitySet Applications. Return Type: ODataListResponseOfApplication For more information about OData responses <a href='https://www.odata.org/getting-started/understand-odata-in-6-steps/'>link</a>. <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.applications_get_by_tenantid(tenant_id, region="UK", async_req=True)
        >>> result = thread.get()

        Args:
            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:
            expand (str): Expands related entities inline.. [optional]
            filter (str): Filters the results, based on a Boolean condition.. [optional]
            select (str): Selects which properties to include in the response.. [optional]
            orderby (str): Sorts the results.. [optional]
            top (int): Returns only the first n results.. [optional]
            skip (int): Skips the first n results.. [optional]
            count (bool): Includes a count of the matching results in the response.. [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:
            ODataListResponseOfApplication
                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
        return self.applications_get_by_tenantid_endpoint.call_with_http_info(**kwargs)

    def applications_get_single_by_applicationid_and_tenantid(
        self,
        application_id,
        tenant_id,
        region="UK",
        **kwargs
    ):
        """Get Applications single by applicationid and tenantid  # noqa: E501

        <span style='font-size: 17px;'>Summary</span><br/>Returns the entity with the key from Applications. Return Type: Application <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.applications_get_single_by_applicationid_and_tenantid(application_id, tenant_id, region="UK", async_req=True)
        >>> result = thread.get()

        Args:
            application_id (int): key: ApplicationId
            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:
            expand (str): Expands related entities inline.. [optional]
            select (str): Selects which properties to include in the response.. [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:
            Application
                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['application_id'] = \
            application_id
        kwargs['tenant_id'] = \
            tenant_id
        kwargs['region'] = \
            region
        return self.applications_get_single_by_applicationid_and_tenantid_endpoint.call_with_http_info(**kwargs)

