# 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.usage_breakdown_v1response import UsageBreakdownV1Response
from .raw_client import AsyncRawBreakdownClient, RawBreakdownClient
from .types.breakdown_get_request_deployment import BreakdownGetRequestDeployment
from .types.breakdown_get_request_endpoint import BreakdownGetRequestEndpoint
from .types.breakdown_get_request_grouping import BreakdownGetRequestGrouping
from .types.breakdown_get_request_method import BreakdownGetRequestMethod


class BreakdownClient:
    def __init__(self, *, client_wrapper: SyncClientWrapper):
        self._raw_client = RawBreakdownClient(client_wrapper=client_wrapper)

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

        Returns
        -------
        RawBreakdownClient
        """
        return self._raw_client

    def get(
        self,
        project_id: str,
        *,
        start: typing.Optional[str] = None,
        end: typing.Optional[str] = None,
        grouping: typing.Optional[BreakdownGetRequestGrouping] = 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[BreakdownGetRequestDeployment] = 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[BreakdownGetRequestEndpoint] = 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[BreakdownGetRequestMethod] = 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,
    ) -> UsageBreakdownV1Response:
        """
        Retrieves the usage breakdown for a specific project, with various filter options by API feature or by groupings. Setting a feature (e.g. diarize) to true includes requests that used that feature, while false excludes requests that used it. Multiple true filters are combined with OR logic, while false filters use AND logic.

        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

        grouping : typing.Optional[BreakdownGetRequestGrouping]
            Common usage grouping parameters

        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[BreakdownGetRequestDeployment]
            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[BreakdownGetRequestEndpoint]
            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[BreakdownGetRequestMethod]
            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
        -------
        UsageBreakdownV1Response
            Usage breakdown response

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

        client = DeepgramClient(
            api_key="YOUR_API_KEY",
        )
        client.manage.v1.projects.usage.breakdown.get(
            project_id="123456-7890-1234-5678-901234",
            start="start",
            end="end",
            grouping="accessor",
            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,
            grouping=grouping,
            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


class AsyncBreakdownClient:
    def __init__(self, *, client_wrapper: AsyncClientWrapper):
        self._raw_client = AsyncRawBreakdownClient(client_wrapper=client_wrapper)

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

        Returns
        -------
        AsyncRawBreakdownClient
        """
        return self._raw_client

    async def get(
        self,
        project_id: str,
        *,
        start: typing.Optional[str] = None,
        end: typing.Optional[str] = None,
        grouping: typing.Optional[BreakdownGetRequestGrouping] = 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[BreakdownGetRequestDeployment] = 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[BreakdownGetRequestEndpoint] = 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[BreakdownGetRequestMethod] = 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,
    ) -> UsageBreakdownV1Response:
        """
        Retrieves the usage breakdown for a specific project, with various filter options by API feature or by groupings. Setting a feature (e.g. diarize) to true includes requests that used that feature, while false excludes requests that used it. Multiple true filters are combined with OR logic, while false filters use AND logic.

        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

        grouping : typing.Optional[BreakdownGetRequestGrouping]
            Common usage grouping parameters

        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[BreakdownGetRequestDeployment]
            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[BreakdownGetRequestEndpoint]
            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[BreakdownGetRequestMethod]
            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
        -------
        UsageBreakdownV1Response
            Usage breakdown response

        Examples
        --------
        import asyncio

        from deepgram import AsyncDeepgramClient

        client = AsyncDeepgramClient(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.manage.v1.projects.usage.breakdown.get(
                project_id="123456-7890-1234-5678-901234",
                start="start",
                end="end",
                grouping="accessor",
                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,
            grouping=grouping,
            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
