"""
    Sample metadata API

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

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


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

from metamist.api_client import ApiClient, Endpoint as _Endpoint
from metamist.model_utils import (  # noqa: F401
    check_allowed_values,
    check_validations,
    date,
    datetime,
    file_type,
    none_type,
    validate_and_convert_types,
    async_wrap
)
from metamist.model.body_export_project_participants import BodyExportProjectParticipants
from metamist.model.export_type import ExportType
from metamist.model.http_validation_error import HTTPValidationError
from metamist.model.project_participant_grid_filter import ProjectParticipantGridFilter
from metamist.model.project_participant_grid_response import ProjectParticipantGridResponse
from metamist.model.project_summary import ProjectSummary
from metamist.model.search_response_model import SearchResponseModel
from metamist.model.seqr_dataset_type import SeqrDatasetType


class WebApi(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.export_project_participants_async = async_wrap(self.export_project_participants)
        self.export_project_participants_endpoint = _Endpoint(
            settings={
                'response_type': (bool, date, datetime, dict, float, int, list, str, none_type,),
                'auth': [
                    'HTTPBearer'
                ],
                'endpoint_path': '/api/v1/web/{project}/participants/export/{export_type}',
                'operation_id': 'export_project_participants',
                'http_method': 'POST',
                'servers': None,
            },
            params_map={
                'all': [
                    'export_type',
                    'project',
                    'body_export_project_participants',
                ],
                'required': [
                    'export_type',
                    'project',
                    'body_export_project_participants',
                ],
                'nullable': [
                ],
                'enum': [
                ],
                'validation': [
                ]
            },
            root_map={
                'validations': {
                },
                'allowed_values': {
                },
                'openapi_types': {
                    'export_type':
                        (ExportType,),
                    'project':
                        (str,),
                    'body_export_project_participants':
                        (BodyExportProjectParticipants,),
                },
                'attribute_map': {
                    'export_type': 'export_type',
                    'project': 'project',
                },
                'location_map': {
                    'export_type': 'path',
                    'project': 'path',
                    'body_export_project_participants': 'body',
                },
                'collection_format_map': {
                }
            },
            headers_map={
                'accept': [
                    'application/json'
                ],
                'content_type': [
                    'application/json'
                ]
            },
            api_client=api_client
        )

        self.get_project_participants_filter_schema_async = async_wrap(self.get_project_participants_filter_schema)
        self.get_project_participants_filter_schema_endpoint = _Endpoint(
            settings={
                'response_type': (bool, date, datetime, dict, float, int, list, str, none_type,),
                'auth': [
                    'HTTPBearer'
                ],
                'endpoint_path': '/api/v1/web/{project}/participants/schema',
                'operation_id': 'get_project_participants_filter_schema',
                'http_method': 'POST',
                'servers': None,
            },
            params_map={
                'all': [
                    'project',
                ],
                'required': [
                    'project',
                ],
                'nullable': [
                ],
                'enum': [
                ],
                'validation': [
                ]
            },
            root_map={
                'validations': {
                },
                'allowed_values': {
                },
                'openapi_types': {
                    'project':
                        (str,),
                },
                'attribute_map': {
                    'project': 'project',
                },
                'location_map': {
                    'project': 'path',
                },
                'collection_format_map': {
                }
            },
            headers_map={
                'accept': [
                    'application/json'
                ],
                'content_type': [],
            },
            api_client=api_client
        )

        self.get_project_participants_grid_with_limit_async = async_wrap(self.get_project_participants_grid_with_limit)
        self.get_project_participants_grid_with_limit_endpoint = _Endpoint(
            settings={
                'response_type': (ProjectParticipantGridResponse,),
                'auth': [
                    'HTTPBearer'
                ],
                'endpoint_path': '/api/v1/web/{project}/participants',
                'operation_id': 'get_project_participants_grid_with_limit',
                'http_method': 'POST',
                'servers': None,
            },
            params_map={
                'all': [
                    'project',
                    'limit',
                    'project_participant_grid_filter',
                    'skip',
                ],
                'required': [
                    'project',
                    'limit',
                    'project_participant_grid_filter',
                ],
                'nullable': [
                ],
                'enum': [
                ],
                'validation': [
                ]
            },
            root_map={
                'validations': {
                },
                'allowed_values': {
                },
                'openapi_types': {
                    'project':
                        (str,),
                    'limit':
                        (int,),
                    'project_participant_grid_filter':
                        (ProjectParticipantGridFilter,),
                    'skip':
                        (int,),
                },
                'attribute_map': {
                    'project': 'project',
                    'limit': 'limit',
                    'skip': 'skip',
                },
                'location_map': {
                    'project': 'path',
                    'limit': 'query',
                    'project_participant_grid_filter': 'body',
                    'skip': 'query',
                },
                'collection_format_map': {
                }
            },
            headers_map={
                'accept': [
                    'application/json'
                ],
                'content_type': [
                    'application/json'
                ]
            },
            api_client=api_client
        )

        self.get_project_summary_async = async_wrap(self.get_project_summary)
        self.get_project_summary_endpoint = _Endpoint(
            settings={
                'response_type': (ProjectSummary,),
                'auth': [
                    'HTTPBearer'
                ],
                'endpoint_path': '/api/v1/web/{project}/summary',
                'operation_id': 'get_project_summary',
                'http_method': 'POST',
                'servers': None,
            },
            params_map={
                'all': [
                    'project',
                ],
                'required': [
                    'project',
                ],
                'nullable': [
                ],
                'enum': [
                ],
                'validation': [
                ]
            },
            root_map={
                'validations': {
                },
                'allowed_values': {
                },
                'openapi_types': {
                    'project':
                        (str,),
                },
                'attribute_map': {
                    'project': 'project',
                },
                'location_map': {
                    'project': 'path',
                },
                'collection_format_map': {
                }
            },
            headers_map={
                'accept': [
                    'application/json'
                ],
                'content_type': [],
            },
            api_client=api_client
        )

        self.search_by_keyword_async = async_wrap(self.search_by_keyword)
        self.search_by_keyword_endpoint = _Endpoint(
            settings={
                'response_type': (SearchResponseModel,),
                'auth': [
                    'HTTPBearer'
                ],
                'endpoint_path': '/api/v1/web/search',
                'operation_id': 'search_by_keyword',
                'http_method': 'GET',
                'servers': None,
            },
            params_map={
                'all': [
                    'keyword',
                ],
                'required': [
                    'keyword',
                ],
                'nullable': [
                ],
                'enum': [
                ],
                'validation': [
                ]
            },
            root_map={
                'validations': {
                },
                'allowed_values': {
                },
                'openapi_types': {
                    'keyword':
                        (str,),
                },
                'attribute_map': {
                    'keyword': 'keyword',
                },
                'location_map': {
                    'keyword': 'query',
                },
                'collection_format_map': {
                }
            },
            headers_map={
                'accept': [
                    'application/json'
                ],
                'content_type': [],
            },
            api_client=api_client
        )

        self.sync_seqr_project_async = async_wrap(self.sync_seqr_project)
        self.sync_seqr_project_endpoint = _Endpoint(
            settings={
                'response_type': (bool, date, datetime, dict, float, int, list, str, none_type,),
                'auth': [
                    'HTTPBearer'
                ],
                'endpoint_path': '/api/v1/web/{project}/{sequencing_type}/sync-dataset',
                'operation_id': 'sync_seqr_project',
                'http_method': 'POST',
                'servers': None,
            },
            params_map={
                'all': [
                    'sequencing_type',
                    'project',
                    'seqr_dataset_type',
                    'sync_families',
                    'sync_individual_metadata',
                    'sync_individuals',
                    'sync_es_index',
                    'sync_saved_variants',
                    'sync_cram_map',
                    'post_slack_notification',
                ],
                'required': [
                    'sequencing_type',
                    'project',
                    'seqr_dataset_type',
                ],
                'nullable': [
                ],
                'enum': [
                ],
                'validation': [
                ]
            },
            root_map={
                'validations': {
                },
                'allowed_values': {
                },
                'openapi_types': {
                    'sequencing_type':
                        (str,),
                    'project':
                        (str,),
                    'seqr_dataset_type':
                        ([SeqrDatasetType],),
                    'sync_families':
                        (bool,),
                    'sync_individual_metadata':
                        (bool,),
                    'sync_individuals':
                        (bool,),
                    'sync_es_index':
                        (bool,),
                    'sync_saved_variants':
                        (bool,),
                    'sync_cram_map':
                        (bool,),
                    'post_slack_notification':
                        (bool,),
                },
                'attribute_map': {
                    'sequencing_type': 'sequencing_type',
                    'project': 'project',
                    'sync_families': 'sync_families',
                    'sync_individual_metadata': 'sync_individual_metadata',
                    'sync_individuals': 'sync_individuals',
                    'sync_es_index': 'sync_es_index',
                    'sync_saved_variants': 'sync_saved_variants',
                    'sync_cram_map': 'sync_cram_map',
                    'post_slack_notification': 'post_slack_notification',
                },
                'location_map': {
                    'sequencing_type': 'path',
                    'project': 'path',
                    'seqr_dataset_type': 'body',
                    'sync_families': 'query',
                    'sync_individual_metadata': 'query',
                    'sync_individuals': 'query',
                    'sync_es_index': 'query',
                    'sync_saved_variants': 'query',
                    'sync_cram_map': 'query',
                    'post_slack_notification': 'query',
                },
                'collection_format_map': {
                }
            },
            headers_map={
                'accept': [
                    'application/json'
                ],
                'content_type': [
                    'application/json'
                ]
            },
            api_client=api_client
        )

    def export_project_participants(
        self,
        export_type,
        project,
        body_export_project_participants,
        **kwargs
    ):
        """Export Project Participants  # noqa: E501

        Get project summary (from query) with some limit  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True

        >>> thread = api.export_project_participants(export_type, project, body_export_project_participants, async_req=True)
        >>> result = thread.get()

        Args:
            export_type (ExportType):
            project (str):
            body_export_project_participants (BodyExportProjectParticipants):

        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.
            _content_type (str/None): force body content-type.
                Default is None and content-type will be predicted by allowed
                content-types and body.
            _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:
            bool, date, datetime, dict, float, int, list, str, none_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['_content_type'] = kwargs.get(
            '_content_type')
        kwargs['_host_index'] = kwargs.get('_host_index')
        kwargs['export_type'] = \
            export_type
        kwargs['project'] = \
            project
        kwargs['body_export_project_participants'] = \
            body_export_project_participants
        return self.export_project_participants_endpoint.call_with_http_info(**kwargs)

    def get_project_participants_filter_schema(
        self,
        project,
        **kwargs
    ):
        """Get Project Project Participants Filter Schema  # noqa: E501

        Get project summary (from query) with some limit  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True

        >>> thread = api.get_project_participants_filter_schema(project, async_req=True)
        >>> result = thread.get()

        Args:
            project (str):

        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.
            _content_type (str/None): force body content-type.
                Default is None and content-type will be predicted by allowed
                content-types and body.
            _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:
            bool, date, datetime, dict, float, int, list, str, none_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['_content_type'] = kwargs.get(
            '_content_type')
        kwargs['_host_index'] = kwargs.get('_host_index')
        kwargs['project'] = \
            project
        return self.get_project_participants_filter_schema_endpoint.call_with_http_info(**kwargs)

    def get_project_participants_grid_with_limit(
        self,
        project,
        limit,
        project_participant_grid_filter,
        **kwargs
    ):
        """Get Project Participants Grid With Limit  # noqa: E501

        Get project summary (from query) with some limit  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True

        >>> thread = api.get_project_participants_grid_with_limit(project, limit, project_participant_grid_filter, async_req=True)
        >>> result = thread.get()

        Args:
            project (str):
            limit (int):
            project_participant_grid_filter (ProjectParticipantGridFilter):

        Keyword Args:
            skip (int): [optional] if omitted the server will use the default value of 0
            _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.
            _content_type (str/None): force body content-type.
                Default is None and content-type will be predicted by allowed
                content-types and body.
            _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:
            ProjectParticipantGridResponse
                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['_content_type'] = kwargs.get(
            '_content_type')
        kwargs['_host_index'] = kwargs.get('_host_index')
        kwargs['project'] = \
            project
        kwargs['limit'] = \
            limit
        kwargs['project_participant_grid_filter'] = \
            project_participant_grid_filter
        return self.get_project_participants_grid_with_limit_endpoint.call_with_http_info(**kwargs)

    def get_project_summary(
        self,
        project,
        **kwargs
    ):
        """Get Project Summary  # noqa: E501

        Creates a new sample, and returns the internal sample ID  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True

        >>> thread = api.get_project_summary(project, async_req=True)
        >>> result = thread.get()

        Args:
            project (str):

        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.
            _content_type (str/None): force body content-type.
                Default is None and content-type will be predicted by allowed
                content-types and body.
            _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:
            ProjectSummary
                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['_content_type'] = kwargs.get(
            '_content_type')
        kwargs['_host_index'] = kwargs.get('_host_index')
        kwargs['project'] = \
            project
        return self.get_project_summary_endpoint.call_with_http_info(**kwargs)

    def search_by_keyword(
        self,
        keyword,
        **kwargs
    ):
        """Search By Keyword  # noqa: E501

        This searches the keyword, in families, participants + samples in the projects that you are a part of (automatically).  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True

        >>> thread = api.search_by_keyword(keyword, async_req=True)
        >>> result = thread.get()

        Args:
            keyword (str):

        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.
            _content_type (str/None): force body content-type.
                Default is None and content-type will be predicted by allowed
                content-types and body.
            _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:
            SearchResponseModel
                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['_content_type'] = kwargs.get(
            '_content_type')
        kwargs['_host_index'] = kwargs.get('_host_index')
        kwargs['keyword'] = \
            keyword
        return self.search_by_keyword_endpoint.call_with_http_info(**kwargs)

    def sync_seqr_project(
        self,
        sequencing_type,
        project,
        seqr_dataset_type,
        **kwargs
    ):
        """Sync Seqr Project  # noqa: E501

        Sync a metamist project with its seqr project (for a specific sequence type) es_index_types: list of any of 'Haplotypecaller', 'SV_Caller', 'Mitochondria_Caller'  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True

        >>> thread = api.sync_seqr_project(sequencing_type, project, seqr_dataset_type, async_req=True)
        >>> result = thread.get()

        Args:
            sequencing_type (str):
            project (str):
            seqr_dataset_type ([SeqrDatasetType]):

        Keyword Args:
            sync_families (bool): [optional] if omitted the server will use the default value of True
            sync_individual_metadata (bool): [optional] if omitted the server will use the default value of True
            sync_individuals (bool): [optional] if omitted the server will use the default value of True
            sync_es_index (bool): [optional] if omitted the server will use the default value of True
            sync_saved_variants (bool): [optional] if omitted the server will use the default value of True
            sync_cram_map (bool): [optional] if omitted the server will use the default value of True
            post_slack_notification (bool): [optional] if omitted the server will use the default value of True
            _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.
            _content_type (str/None): force body content-type.
                Default is None and content-type will be predicted by allowed
                content-types and body.
            _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:
            bool, date, datetime, dict, float, int, list, str, none_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['_content_type'] = kwargs.get(
            '_content_type')
        kwargs['_host_index'] = kwargs.get('_host_index')
        kwargs['sequencing_type'] = \
            sequencing_type
        kwargs['project'] = \
            project
        kwargs['seqr_dataset_type'] = \
            seqr_dataset_type
        return self.sync_seqr_project_endpoint.call_with_http_info(**kwargs)

