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

from __future__ import annotations

import typing

from .....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
from .....core.request_options import RequestOptions
from .....types.usage_v1response import UsageV1Response
from .raw_client import AsyncRawUsageClient, RawUsageClient
from .types.usage_get_request_deployment import UsageGetRequestDeployment
from .types.usage_get_request_endpoint import UsageGetRequestEndpoint
from .types.usage_get_request_method import UsageGetRequestMethod

if typing.TYPE_CHECKING:
    from .breakdown.client import AsyncBreakdownClient, BreakdownClient
    from .fields.client import AsyncFieldsClient, FieldsClient


class UsageClient:
    def __init__(self, *, client_wrapper: SyncClientWrapper):
        self._raw_client = RawUsageClient(client_wrapper=client_wrapper)
        self._client_wrapper = client_wrapper
        self._breakdown: typing.Optional[BreakdownClient] = None
        self._fields: typing.Optional[FieldsClient] = None

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

        Returns
        -------
        RawUsageClient
        """
        return self._raw_client

    def get(
        self,
        project_id: str,
        *,
        start: typing.Optional[str] = None,
        end: typing.Optional[str] = None,
        accessor: typing.Optional[str] = None,
        alternatives: typing.Optional[bool] = None,
        callback_method: typing.Optional[bool] = None,
        callback: typing.Optional[bool] = None,
        channels: typing.Optional[bool] = None,
        custom_intent_mode: typing.Optional[bool] = None,
        custom_intent: typing.Optional[bool] = None,
        custom_topic_mode: typing.Optional[bool] = None,
        custom_topic: typing.Optional[bool] = None,
        deployment: typing.Optional[UsageGetRequestDeployment] = None,
        detect_entities: typing.Optional[bool] = None,
        detect_language: typing.Optional[bool] = None,
        diarize: typing.Optional[bool] = None,
        dictation: typing.Optional[bool] = None,
        encoding: typing.Optional[bool] = None,
        endpoint: typing.Optional[UsageGetRequestEndpoint] = None,
        extra: typing.Optional[bool] = None,
        filler_words: typing.Optional[bool] = None,
        intents: typing.Optional[bool] = None,
        keyterm: typing.Optional[bool] = None,
        keywords: typing.Optional[bool] = None,
        language: typing.Optional[bool] = None,
        measurements: typing.Optional[bool] = None,
        method: typing.Optional[UsageGetRequestMethod] = None,
        model: typing.Optional[str] = None,
        multichannel: typing.Optional[bool] = None,
        numerals: typing.Optional[bool] = None,
        paragraphs: typing.Optional[bool] = None,
        profanity_filter: typing.Optional[bool] = None,
        punctuate: typing.Optional[bool] = None,
        redact: typing.Optional[bool] = None,
        replace: typing.Optional[bool] = None,
        sample_rate: typing.Optional[bool] = None,
        search: typing.Optional[bool] = None,
        sentiment: typing.Optional[bool] = None,
        smart_format: typing.Optional[bool] = None,
        summarize: typing.Optional[bool] = None,
        tag: typing.Optional[str] = None,
        topics: typing.Optional[bool] = None,
        utt_split: typing.Optional[bool] = None,
        utterances: typing.Optional[bool] = None,
        version: typing.Optional[bool] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> UsageV1Response:
        """
        Retrieves the usage for a specific project. Use Get Project Usage Breakdown for a more comprehensive usage summary.

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

        start : typing.Optional[str]
            Start date of the requested date range. Format accepted is YYYY-MM-DD

        end : typing.Optional[str]
            End date of the requested date range. Format accepted is YYYY-MM-DD

        accessor : typing.Optional[str]
            Filter for requests where a specific accessor was used

        alternatives : typing.Optional[bool]
            Filter for requests where alternatives were used

        callback_method : typing.Optional[bool]
            Filter for requests where callback method was used

        callback : typing.Optional[bool]
            Filter for requests where callback was used

        channels : typing.Optional[bool]
            Filter for requests where channels were used

        custom_intent_mode : typing.Optional[bool]
            Filter for requests where custom intent mode was used

        custom_intent : typing.Optional[bool]
            Filter for requests where custom intent was used

        custom_topic_mode : typing.Optional[bool]
            Filter for requests where custom topic mode was used

        custom_topic : typing.Optional[bool]
            Filter for requests where custom topic was used

        deployment : typing.Optional[UsageGetRequestDeployment]
            Filter for requests where a specific deployment was used

        detect_entities : typing.Optional[bool]
            Filter for requests where detect entities was used

        detect_language : typing.Optional[bool]
            Filter for requests where detect language was used

        diarize : typing.Optional[bool]
            Filter for requests where diarize was used

        dictation : typing.Optional[bool]
            Filter for requests where dictation was used

        encoding : typing.Optional[bool]
            Filter for requests where encoding was used

        endpoint : typing.Optional[UsageGetRequestEndpoint]
            Filter for requests where a specific endpoint was used

        extra : typing.Optional[bool]
            Filter for requests where extra was used

        filler_words : typing.Optional[bool]
            Filter for requests where filler words was used

        intents : typing.Optional[bool]
            Filter for requests where intents was used

        keyterm : typing.Optional[bool]
            Filter for requests where keyterm was used

        keywords : typing.Optional[bool]
            Filter for requests where keywords was used

        language : typing.Optional[bool]
            Filter for requests where language was used

        measurements : typing.Optional[bool]
            Filter for requests where measurements were used

        method : typing.Optional[UsageGetRequestMethod]
            Filter for requests where a specific method was used

        model : typing.Optional[str]
            Filter for requests where a specific model uuid was used

        multichannel : typing.Optional[bool]
            Filter for requests where multichannel was used

        numerals : typing.Optional[bool]
            Filter for requests where numerals were used

        paragraphs : typing.Optional[bool]
            Filter for requests where paragraphs were used

        profanity_filter : typing.Optional[bool]
            Filter for requests where profanity filter was used

        punctuate : typing.Optional[bool]
            Filter for requests where punctuate was used

        redact : typing.Optional[bool]
            Filter for requests where redact was used

        replace : typing.Optional[bool]
            Filter for requests where replace was used

        sample_rate : typing.Optional[bool]
            Filter for requests where sample rate was used

        search : typing.Optional[bool]
            Filter for requests where search was used

        sentiment : typing.Optional[bool]
            Filter for requests where sentiment was used

        smart_format : typing.Optional[bool]
            Filter for requests where smart format was used

        summarize : typing.Optional[bool]
            Filter for requests where summarize was used

        tag : typing.Optional[str]
            Filter for requests where a specific tag was used

        topics : typing.Optional[bool]
            Filter for requests where topics was used

        utt_split : typing.Optional[bool]
            Filter for requests where utt split was used

        utterances : typing.Optional[bool]
            Filter for requests where utterances was used

        version : typing.Optional[bool]
            Filter for requests where version was used

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

        Returns
        -------
        UsageV1Response
            A specific request for a specific project

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

        client = DeepgramClient(
            api_key="YOUR_API_KEY",
        )
        client.manage.v1.projects.usage.get(
            project_id="123456-7890-1234-5678-901234",
            start="start",
            end="end",
            accessor="12345678-1234-1234-1234-123456789012",
            alternatives=True,
            callback_method=True,
            callback=True,
            channels=True,
            custom_intent_mode=True,
            custom_intent=True,
            custom_topic_mode=True,
            custom_topic=True,
            deployment="hosted",
            detect_entities=True,
            detect_language=True,
            diarize=True,
            dictation=True,
            encoding=True,
            endpoint="listen",
            extra=True,
            filler_words=True,
            intents=True,
            keyterm=True,
            keywords=True,
            language=True,
            measurements=True,
            method="sync",
            model="6f548761-c9c0-429a-9315-11a1d28499c8",
            multichannel=True,
            numerals=True,
            paragraphs=True,
            profanity_filter=True,
            punctuate=True,
            redact=True,
            replace=True,
            sample_rate=True,
            search=True,
            sentiment=True,
            smart_format=True,
            summarize=True,
            tag="tag1",
            topics=True,
            utt_split=True,
            utterances=True,
            version=True,
        )
        """
        _response = self._raw_client.get(
            project_id,
            start=start,
            end=end,
            accessor=accessor,
            alternatives=alternatives,
            callback_method=callback_method,
            callback=callback,
            channels=channels,
            custom_intent_mode=custom_intent_mode,
            custom_intent=custom_intent,
            custom_topic_mode=custom_topic_mode,
            custom_topic=custom_topic,
            deployment=deployment,
            detect_entities=detect_entities,
            detect_language=detect_language,
            diarize=diarize,
            dictation=dictation,
            encoding=encoding,
            endpoint=endpoint,
            extra=extra,
            filler_words=filler_words,
            intents=intents,
            keyterm=keyterm,
            keywords=keywords,
            language=language,
            measurements=measurements,
            method=method,
            model=model,
            multichannel=multichannel,
            numerals=numerals,
            paragraphs=paragraphs,
            profanity_filter=profanity_filter,
            punctuate=punctuate,
            redact=redact,
            replace=replace,
            sample_rate=sample_rate,
            search=search,
            sentiment=sentiment,
            smart_format=smart_format,
            summarize=summarize,
            tag=tag,
            topics=topics,
            utt_split=utt_split,
            utterances=utterances,
            version=version,
            request_options=request_options,
        )
        return _response.data

    @property
    def breakdown(self):
        if self._breakdown is None:
            from .breakdown.client import BreakdownClient  # noqa: E402

            self._breakdown = BreakdownClient(client_wrapper=self._client_wrapper)
        return self._breakdown

    @property
    def fields(self):
        if self._fields is None:
            from .fields.client import FieldsClient  # noqa: E402

            self._fields = FieldsClient(client_wrapper=self._client_wrapper)
        return self._fields


class AsyncUsageClient:
    def __init__(self, *, client_wrapper: AsyncClientWrapper):
        self._raw_client = AsyncRawUsageClient(client_wrapper=client_wrapper)
        self._client_wrapper = client_wrapper
        self._breakdown: typing.Optional[AsyncBreakdownClient] = None
        self._fields: typing.Optional[AsyncFieldsClient] = None

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

        Returns
        -------
        AsyncRawUsageClient
        """
        return self._raw_client

    async def get(
        self,
        project_id: str,
        *,
        start: typing.Optional[str] = None,
        end: typing.Optional[str] = None,
        accessor: typing.Optional[str] = None,
        alternatives: typing.Optional[bool] = None,
        callback_method: typing.Optional[bool] = None,
        callback: typing.Optional[bool] = None,
        channels: typing.Optional[bool] = None,
        custom_intent_mode: typing.Optional[bool] = None,
        custom_intent: typing.Optional[bool] = None,
        custom_topic_mode: typing.Optional[bool] = None,
        custom_topic: typing.Optional[bool] = None,
        deployment: typing.Optional[UsageGetRequestDeployment] = None,
        detect_entities: typing.Optional[bool] = None,
        detect_language: typing.Optional[bool] = None,
        diarize: typing.Optional[bool] = None,
        dictation: typing.Optional[bool] = None,
        encoding: typing.Optional[bool] = None,
        endpoint: typing.Optional[UsageGetRequestEndpoint] = None,
        extra: typing.Optional[bool] = None,
        filler_words: typing.Optional[bool] = None,
        intents: typing.Optional[bool] = None,
        keyterm: typing.Optional[bool] = None,
        keywords: typing.Optional[bool] = None,
        language: typing.Optional[bool] = None,
        measurements: typing.Optional[bool] = None,
        method: typing.Optional[UsageGetRequestMethod] = None,
        model: typing.Optional[str] = None,
        multichannel: typing.Optional[bool] = None,
        numerals: typing.Optional[bool] = None,
        paragraphs: typing.Optional[bool] = None,
        profanity_filter: typing.Optional[bool] = None,
        punctuate: typing.Optional[bool] = None,
        redact: typing.Optional[bool] = None,
        replace: typing.Optional[bool] = None,
        sample_rate: typing.Optional[bool] = None,
        search: typing.Optional[bool] = None,
        sentiment: typing.Optional[bool] = None,
        smart_format: typing.Optional[bool] = None,
        summarize: typing.Optional[bool] = None,
        tag: typing.Optional[str] = None,
        topics: typing.Optional[bool] = None,
        utt_split: typing.Optional[bool] = None,
        utterances: typing.Optional[bool] = None,
        version: typing.Optional[bool] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> UsageV1Response:
        """
        Retrieves the usage for a specific project. Use Get Project Usage Breakdown for a more comprehensive usage summary.

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

        start : typing.Optional[str]
            Start date of the requested date range. Format accepted is YYYY-MM-DD

        end : typing.Optional[str]
            End date of the requested date range. Format accepted is YYYY-MM-DD

        accessor : typing.Optional[str]
            Filter for requests where a specific accessor was used

        alternatives : typing.Optional[bool]
            Filter for requests where alternatives were used

        callback_method : typing.Optional[bool]
            Filter for requests where callback method was used

        callback : typing.Optional[bool]
            Filter for requests where callback was used

        channels : typing.Optional[bool]
            Filter for requests where channels were used

        custom_intent_mode : typing.Optional[bool]
            Filter for requests where custom intent mode was used

        custom_intent : typing.Optional[bool]
            Filter for requests where custom intent was used

        custom_topic_mode : typing.Optional[bool]
            Filter for requests where custom topic mode was used

        custom_topic : typing.Optional[bool]
            Filter for requests where custom topic was used

        deployment : typing.Optional[UsageGetRequestDeployment]
            Filter for requests where a specific deployment was used

        detect_entities : typing.Optional[bool]
            Filter for requests where detect entities was used

        detect_language : typing.Optional[bool]
            Filter for requests where detect language was used

        diarize : typing.Optional[bool]
            Filter for requests where diarize was used

        dictation : typing.Optional[bool]
            Filter for requests where dictation was used

        encoding : typing.Optional[bool]
            Filter for requests where encoding was used

        endpoint : typing.Optional[UsageGetRequestEndpoint]
            Filter for requests where a specific endpoint was used

        extra : typing.Optional[bool]
            Filter for requests where extra was used

        filler_words : typing.Optional[bool]
            Filter for requests where filler words was used

        intents : typing.Optional[bool]
            Filter for requests where intents was used

        keyterm : typing.Optional[bool]
            Filter for requests where keyterm was used

        keywords : typing.Optional[bool]
            Filter for requests where keywords was used

        language : typing.Optional[bool]
            Filter for requests where language was used

        measurements : typing.Optional[bool]
            Filter for requests where measurements were used

        method : typing.Optional[UsageGetRequestMethod]
            Filter for requests where a specific method was used

        model : typing.Optional[str]
            Filter for requests where a specific model uuid was used

        multichannel : typing.Optional[bool]
            Filter for requests where multichannel was used

        numerals : typing.Optional[bool]
            Filter for requests where numerals were used

        paragraphs : typing.Optional[bool]
            Filter for requests where paragraphs were used

        profanity_filter : typing.Optional[bool]
            Filter for requests where profanity filter was used

        punctuate : typing.Optional[bool]
            Filter for requests where punctuate was used

        redact : typing.Optional[bool]
            Filter for requests where redact was used

        replace : typing.Optional[bool]
            Filter for requests where replace was used

        sample_rate : typing.Optional[bool]
            Filter for requests where sample rate was used

        search : typing.Optional[bool]
            Filter for requests where search was used

        sentiment : typing.Optional[bool]
            Filter for requests where sentiment was used

        smart_format : typing.Optional[bool]
            Filter for requests where smart format was used

        summarize : typing.Optional[bool]
            Filter for requests where summarize was used

        tag : typing.Optional[str]
            Filter for requests where a specific tag was used

        topics : typing.Optional[bool]
            Filter for requests where topics was used

        utt_split : typing.Optional[bool]
            Filter for requests where utt split was used

        utterances : typing.Optional[bool]
            Filter for requests where utterances was used

        version : typing.Optional[bool]
            Filter for requests where version was used

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

        Returns
        -------
        UsageV1Response
            A specific request for a specific project

        Examples
        --------
        import asyncio

        from deepgram import AsyncDeepgramClient

        client = AsyncDeepgramClient(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.manage.v1.projects.usage.get(
                project_id="123456-7890-1234-5678-901234",
                start="start",
                end="end",
                accessor="12345678-1234-1234-1234-123456789012",
                alternatives=True,
                callback_method=True,
                callback=True,
                channels=True,
                custom_intent_mode=True,
                custom_intent=True,
                custom_topic_mode=True,
                custom_topic=True,
                deployment="hosted",
                detect_entities=True,
                detect_language=True,
                diarize=True,
                dictation=True,
                encoding=True,
                endpoint="listen",
                extra=True,
                filler_words=True,
                intents=True,
                keyterm=True,
                keywords=True,
                language=True,
                measurements=True,
                method="sync",
                model="6f548761-c9c0-429a-9315-11a1d28499c8",
                multichannel=True,
                numerals=True,
                paragraphs=True,
                profanity_filter=True,
                punctuate=True,
                redact=True,
                replace=True,
                sample_rate=True,
                search=True,
                sentiment=True,
                smart_format=True,
                summarize=True,
                tag="tag1",
                topics=True,
                utt_split=True,
                utterances=True,
                version=True,
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.get(
            project_id,
            start=start,
            end=end,
            accessor=accessor,
            alternatives=alternatives,
            callback_method=callback_method,
            callback=callback,
            channels=channels,
            custom_intent_mode=custom_intent_mode,
            custom_intent=custom_intent,
            custom_topic_mode=custom_topic_mode,
            custom_topic=custom_topic,
            deployment=deployment,
            detect_entities=detect_entities,
            detect_language=detect_language,
            diarize=diarize,
            dictation=dictation,
            encoding=encoding,
            endpoint=endpoint,
            extra=extra,
            filler_words=filler_words,
            intents=intents,
            keyterm=keyterm,
            keywords=keywords,
            language=language,
            measurements=measurements,
            method=method,
            model=model,
            multichannel=multichannel,
            numerals=numerals,
            paragraphs=paragraphs,
            profanity_filter=profanity_filter,
            punctuate=punctuate,
            redact=redact,
            replace=replace,
            sample_rate=sample_rate,
            search=search,
            sentiment=sentiment,
            smart_format=smart_format,
            summarize=summarize,
            tag=tag,
            topics=topics,
            utt_split=utt_split,
            utterances=utterances,
            version=version,
            request_options=request_options,
        )
        return _response.data

    @property
    def breakdown(self):
        if self._breakdown is None:
            from .breakdown.client import AsyncBreakdownClient  # noqa: E402

            self._breakdown = AsyncBreakdownClient(client_wrapper=self._client_wrapper)
        return self._breakdown

    @property
    def fields(self):
        if self._fields is None:
            from .fields.client import AsyncFieldsClient  # noqa: E402

            self._fields = AsyncFieldsClient(client_wrapper=self._client_wrapper)
        return self._fields
