# This file was auto-generated by Fern from our API Definition.

import typing

from .. import core
from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
from ..core.request_options import RequestOptions
from ..types.parsing_job import ParsingJob
from .raw_client import AsyncRawLabReportClient, RawLabReportClient

# this is used as the default value for optional parameters
OMIT = typing.cast(typing.Any, ...)


class LabReportClient:
    def __init__(self, *, client_wrapper: SyncClientWrapper):
        self._raw_client = RawLabReportClient(client_wrapper=client_wrapper)

    @property
    def with_raw_response(self) -> RawLabReportClient:
        """
        Retrieves a raw implementation of this client that returns raw responses.

        Returns
        -------
        RawLabReportClient
        """
        return self._raw_client

    def parser_create_job(
        self,
        *,
        file: core.File,
        needs_human_review: typing.Optional[bool] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> ParsingJob:
        """
        Creates a parse job, uploads the file to provider, persists the job row,
        and starts the ParseLabReport. Returns a generated job_id.

        Parameters
        ----------
        file : core.File
            See core.File for more documentation

        needs_human_review : typing.Optional[bool]

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        ParsingJob
            Successful Response

        Examples
        --------
        from vital import Vital
        client = Vital(api_key="YOUR_API_KEY", )
        client.lab_report.parser_create_job()
        """
        _response = self._raw_client.parser_create_job(
            file=file, needs_human_review=needs_human_review, request_options=request_options
        )
        return _response.data

    def parser_get_job(self, job_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> ParsingJob:
        """
        Retrieves the parse job status and stored result if completed.

        Returns:
            ParseLabResultJobResponse with job status and parsed data (if complete)

        Parameters
        ----------
        job_id : str

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        ParsingJob
            Successful Response

        Examples
        --------
        from vital import Vital
        client = Vital(api_key="YOUR_API_KEY", )
        client.lab_report.parser_get_job(job_id='job_id', )
        """
        _response = self._raw_client.parser_get_job(job_id, request_options=request_options)
        return _response.data


class AsyncLabReportClient:
    def __init__(self, *, client_wrapper: AsyncClientWrapper):
        self._raw_client = AsyncRawLabReportClient(client_wrapper=client_wrapper)

    @property
    def with_raw_response(self) -> AsyncRawLabReportClient:
        """
        Retrieves a raw implementation of this client that returns raw responses.

        Returns
        -------
        AsyncRawLabReportClient
        """
        return self._raw_client

    async def parser_create_job(
        self,
        *,
        file: core.File,
        needs_human_review: typing.Optional[bool] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> ParsingJob:
        """
        Creates a parse job, uploads the file to provider, persists the job row,
        and starts the ParseLabReport. Returns a generated job_id.

        Parameters
        ----------
        file : core.File
            See core.File for more documentation

        needs_human_review : typing.Optional[bool]

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        ParsingJob
            Successful Response

        Examples
        --------
        from vital import AsyncVital
        import asyncio
        client = AsyncVital(api_key="YOUR_API_KEY", )
        async def main() -> None:
            await client.lab_report.parser_create_job()
        asyncio.run(main())
        """
        _response = await self._raw_client.parser_create_job(
            file=file, needs_human_review=needs_human_review, request_options=request_options
        )
        return _response.data

    async def parser_get_job(
        self, job_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> ParsingJob:
        """
        Retrieves the parse job status and stored result if completed.

        Returns:
            ParseLabResultJobResponse with job status and parsed data (if complete)

        Parameters
        ----------
        job_id : str

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        ParsingJob
            Successful Response

        Examples
        --------
        from vital import AsyncVital
        import asyncio
        client = AsyncVital(api_key="YOUR_API_KEY", )
        async def main() -> None:
            await client.lab_report.parser_get_job(job_id='job_id', )
        asyncio.run(main())
        """
        _response = await self._raw_client.parser_get_job(job_id, request_options=request_options)
        return _response.data
