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

import datetime as dt
import typing

from .....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
from .....core.request_options import RequestOptions
from ....commons.types.claim_id import ClaimId
from ....commons.types.page_token import PageToken
from .raw_client import AsyncRawV1Client, RawV1Client
from .types.invoice_itemization_response import InvoiceItemizationResponse
from .types.list_inventory_paged_response import ListInventoryPagedResponse


class V1Client:
    def __init__(self, *, client_wrapper: SyncClientWrapper):
        self._raw_client = RawV1Client(client_wrapper=client_wrapper)

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

        Returns
        -------
        RawV1Client
        """
        return self._raw_client

    def list_inventory(
        self,
        *,
        since: typing.Optional[dt.datetime] = None,
        limit: typing.Optional[int] = None,
        page_token: typing.Optional[PageToken] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> ListInventoryPagedResponse:
        """
        Retrieve a list of inventory records based on the provided filters. Each inventory record provides the latest invoiceable status of the associated claim.
        The response is paginated, and the `page_token` can be used to retrieve subsequent pages. Initial requests should not include `page_token`.

        Parameters
        ----------
        since : typing.Optional[dt.datetime]
            Timestamp to filter records since, inclusive

        limit : typing.Optional[int]
            Maximum number of records to return, default is 100

        page_token : typing.Optional[PageToken]

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

        Returns
        -------
        ListInventoryPagedResponse

        Examples
        --------
        from candid import CandidApiClient

        client = CandidApiClient(
            client_id="YOUR_CLIENT_ID",
            client_secret="YOUR_CLIENT_SECRET",
        )
        client.patient_ar.v_1.list_inventory()
        """
        _response = self._raw_client.list_inventory(
            since=since, limit=limit, page_token=page_token, request_options=request_options
        )
        return _response.data

    def itemize(
        self, claim_id: ClaimId, *, request_options: typing.Optional[RequestOptions] = None
    ) -> InvoiceItemizationResponse:
        """
        Provides detailed itemization of invoice data for a specific claim.

        Parameters
        ----------
        claim_id : ClaimId

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

        Returns
        -------
        InvoiceItemizationResponse

        Examples
        --------
        import uuid

        from candid import CandidApiClient

        client = CandidApiClient(
            client_id="YOUR_CLIENT_ID",
            client_secret="YOUR_CLIENT_SECRET",
        )
        client.patient_ar.v_1.itemize(
            claim_id=uuid.UUID(
                "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32",
            ),
        )
        """
        _response = self._raw_client.itemize(claim_id, request_options=request_options)
        return _response.data


class AsyncV1Client:
    def __init__(self, *, client_wrapper: AsyncClientWrapper):
        self._raw_client = AsyncRawV1Client(client_wrapper=client_wrapper)

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

        Returns
        -------
        AsyncRawV1Client
        """
        return self._raw_client

    async def list_inventory(
        self,
        *,
        since: typing.Optional[dt.datetime] = None,
        limit: typing.Optional[int] = None,
        page_token: typing.Optional[PageToken] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> ListInventoryPagedResponse:
        """
        Retrieve a list of inventory records based on the provided filters. Each inventory record provides the latest invoiceable status of the associated claim.
        The response is paginated, and the `page_token` can be used to retrieve subsequent pages. Initial requests should not include `page_token`.

        Parameters
        ----------
        since : typing.Optional[dt.datetime]
            Timestamp to filter records since, inclusive

        limit : typing.Optional[int]
            Maximum number of records to return, default is 100

        page_token : typing.Optional[PageToken]

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

        Returns
        -------
        ListInventoryPagedResponse

        Examples
        --------
        import asyncio

        from candid import AsyncCandidApiClient

        client = AsyncCandidApiClient(
            client_id="YOUR_CLIENT_ID",
            client_secret="YOUR_CLIENT_SECRET",
        )


        async def main() -> None:
            await client.patient_ar.v_1.list_inventory()


        asyncio.run(main())
        """
        _response = await self._raw_client.list_inventory(
            since=since, limit=limit, page_token=page_token, request_options=request_options
        )
        return _response.data

    async def itemize(
        self, claim_id: ClaimId, *, request_options: typing.Optional[RequestOptions] = None
    ) -> InvoiceItemizationResponse:
        """
        Provides detailed itemization of invoice data for a specific claim.

        Parameters
        ----------
        claim_id : ClaimId

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

        Returns
        -------
        InvoiceItemizationResponse

        Examples
        --------
        import asyncio
        import uuid

        from candid import AsyncCandidApiClient

        client = AsyncCandidApiClient(
            client_id="YOUR_CLIENT_ID",
            client_secret="YOUR_CLIENT_SECRET",
        )


        async def main() -> None:
            await client.patient_ar.v_1.itemize(
                claim_id=uuid.UUID(
                    "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32",
                ),
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.itemize(claim_id, request_options=request_options)
        return _response.data
