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

import typing

from ......core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
from ......core.request_options import RequestOptions
from ......types.get_project_balance_v1response import GetProjectBalanceV1Response
from ......types.list_project_balances_v1response import ListProjectBalancesV1Response
from .raw_client import AsyncRawBalancesClient, RawBalancesClient


class BalancesClient:
    def __init__(self, *, client_wrapper: SyncClientWrapper):
        self._raw_client = RawBalancesClient(client_wrapper=client_wrapper)

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

        Returns
        -------
        RawBalancesClient
        """
        return self._raw_client

    def list(
        self, project_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> ListProjectBalancesV1Response:
        """
        Generates a list of outstanding balances for the specified project

        Parameters
        ----------
        project_id : str
            The unique identifier of the project

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

        Returns
        -------
        ListProjectBalancesV1Response
            A list of outstanding balances

        Examples
        --------
        from deepgram import DeepgramClient

        client = DeepgramClient(
            api_key="YOUR_API_KEY",
        )
        client.manage.v1.projects.billing.balances.list(
            project_id="123456-7890-1234-5678-901234",
        )
        """
        _response = self._raw_client.list(project_id, request_options=request_options)
        return _response.data

    def get(
        self, project_id: str, balance_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> GetProjectBalanceV1Response:
        """
        Retrieves details about the specified balance

        Parameters
        ----------
        project_id : str
            The unique identifier of the project

        balance_id : str
            The unique identifier of the balance

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

        Returns
        -------
        GetProjectBalanceV1Response
            A specific balance

        Examples
        --------
        from deepgram import DeepgramClient

        client = DeepgramClient(
            api_key="YOUR_API_KEY",
        )
        client.manage.v1.projects.billing.balances.get(
            project_id="123456-7890-1234-5678-901234",
            balance_id="123456-7890-1234-5678-901234",
        )
        """
        _response = self._raw_client.get(project_id, balance_id, request_options=request_options)
        return _response.data


class AsyncBalancesClient:
    def __init__(self, *, client_wrapper: AsyncClientWrapper):
        self._raw_client = AsyncRawBalancesClient(client_wrapper=client_wrapper)

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

        Returns
        -------
        AsyncRawBalancesClient
        """
        return self._raw_client

    async def list(
        self, project_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> ListProjectBalancesV1Response:
        """
        Generates a list of outstanding balances for the specified project

        Parameters
        ----------
        project_id : str
            The unique identifier of the project

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

        Returns
        -------
        ListProjectBalancesV1Response
            A list of outstanding balances

        Examples
        --------
        import asyncio

        from deepgram import AsyncDeepgramClient

        client = AsyncDeepgramClient(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.manage.v1.projects.billing.balances.list(
                project_id="123456-7890-1234-5678-901234",
            )


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

    async def get(
        self, project_id: str, balance_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> GetProjectBalanceV1Response:
        """
        Retrieves details about the specified balance

        Parameters
        ----------
        project_id : str
            The unique identifier of the project

        balance_id : str
            The unique identifier of the balance

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

        Returns
        -------
        GetProjectBalanceV1Response
            A specific balance

        Examples
        --------
        import asyncio

        from deepgram import AsyncDeepgramClient

        client = AsyncDeepgramClient(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.manage.v1.projects.billing.balances.get(
                project_id="123456-7890-1234-5678-901234",
                balance_id="123456-7890-1234-5678-901234",
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.get(project_id, balance_id, request_options=request_options)
        return _response.data
