# 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.create_translated_tts_out import CreateTranslatedTtsOut
from ..types.formalities import Formalities
from ..types.gender import Gender
from ..types.languages import Languages
from ..types.orchestrator_pipeline_result import OrchestratorPipelineResult
from .raw_client import AsyncRawTranslatedTtsClient, RawTranslatedTtsClient

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


class TranslatedTtsClient:
    def __init__(self, *, client_wrapper: SyncClientWrapper):
        self._raw_client = RawTranslatedTtsClient(client_wrapper=client_wrapper)

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

        Returns
        -------
        RawTranslatedTtsClient
        """
        return self._raw_client

    def create_translated_tts(
        self,
        *,
        text: str,
        voice_id: int,
        source_language: Languages,
        target_language: Languages,
        run_id: typing.Optional[int] = None,
        traceparent: typing.Optional[str] = None,
        project_name: typing.Optional[str] = OMIT,
        project_description: typing.Optional[str] = OMIT,
        folder_id: typing.Optional[int] = OMIT,
        age: typing.Optional[int] = OMIT,
        formality: typing.Optional[Formalities] = OMIT,
        gender: typing.Optional[Gender] = OMIT,
        chosen_dictionaries: typing.Optional[typing.Sequence[int]] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> CreateTranslatedTtsOut:
        """
        Parameters
        ----------
        text : str

        voice_id : int

        source_language : Languages

        target_language : Languages

        run_id : typing.Optional[int]

        traceparent : typing.Optional[str]

        project_name : typing.Optional[str]

        project_description : typing.Optional[str]

        folder_id : typing.Optional[int]

        age : typing.Optional[int]

        formality : typing.Optional[Formalities]

        gender : typing.Optional[Gender]

        chosen_dictionaries : typing.Optional[typing.Sequence[int]]

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

        Returns
        -------
        CreateTranslatedTtsOut
            Successful Response

        Examples
        --------
        from camb import CambApi

        client = CambApi(
            api_key="YOUR_API_KEY",
        )
        client.translated_tts.create_translated_tts(
            text="text",
            voice_id=1,
            source_language=1,
            target_language=1,
        )
        """
        _response = self._raw_client.create_translated_tts(
            text=text,
            voice_id=voice_id,
            source_language=source_language,
            target_language=target_language,
            run_id=run_id,
            traceparent=traceparent,
            project_name=project_name,
            project_description=project_description,
            folder_id=folder_id,
            age=age,
            formality=formality,
            gender=gender,
            chosen_dictionaries=chosen_dictionaries,
            request_options=request_options,
        )
        return _response.data

    def get_translated_tts_task_status(
        self,
        task_id: str,
        *,
        run_id: typing.Optional[int] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> OrchestratorPipelineResult:
        """
        Parameters
        ----------
        task_id : str

        run_id : typing.Optional[int]

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

        Returns
        -------
        OrchestratorPipelineResult
            Successful Response

        Examples
        --------
        from camb import CambApi

        client = CambApi(
            api_key="YOUR_API_KEY",
        )
        client.translated_tts.get_translated_tts_task_status(
            task_id="task_id",
        )
        """
        _response = self._raw_client.get_translated_tts_task_status(
            task_id, run_id=run_id, request_options=request_options
        )
        return _response.data


class AsyncTranslatedTtsClient:
    def __init__(self, *, client_wrapper: AsyncClientWrapper):
        self._raw_client = AsyncRawTranslatedTtsClient(client_wrapper=client_wrapper)

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

        Returns
        -------
        AsyncRawTranslatedTtsClient
        """
        return self._raw_client

    async def create_translated_tts(
        self,
        *,
        text: str,
        voice_id: int,
        source_language: Languages,
        target_language: Languages,
        run_id: typing.Optional[int] = None,
        traceparent: typing.Optional[str] = None,
        project_name: typing.Optional[str] = OMIT,
        project_description: typing.Optional[str] = OMIT,
        folder_id: typing.Optional[int] = OMIT,
        age: typing.Optional[int] = OMIT,
        formality: typing.Optional[Formalities] = OMIT,
        gender: typing.Optional[Gender] = OMIT,
        chosen_dictionaries: typing.Optional[typing.Sequence[int]] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> CreateTranslatedTtsOut:
        """
        Parameters
        ----------
        text : str

        voice_id : int

        source_language : Languages

        target_language : Languages

        run_id : typing.Optional[int]

        traceparent : typing.Optional[str]

        project_name : typing.Optional[str]

        project_description : typing.Optional[str]

        folder_id : typing.Optional[int]

        age : typing.Optional[int]

        formality : typing.Optional[Formalities]

        gender : typing.Optional[Gender]

        chosen_dictionaries : typing.Optional[typing.Sequence[int]]

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

        Returns
        -------
        CreateTranslatedTtsOut
            Successful Response

        Examples
        --------
        import asyncio

        from camb import AsyncCambApi

        client = AsyncCambApi(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.translated_tts.create_translated_tts(
                text="text",
                voice_id=1,
                source_language=1,
                target_language=1,
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.create_translated_tts(
            text=text,
            voice_id=voice_id,
            source_language=source_language,
            target_language=target_language,
            run_id=run_id,
            traceparent=traceparent,
            project_name=project_name,
            project_description=project_description,
            folder_id=folder_id,
            age=age,
            formality=formality,
            gender=gender,
            chosen_dictionaries=chosen_dictionaries,
            request_options=request_options,
        )
        return _response.data

    async def get_translated_tts_task_status(
        self,
        task_id: str,
        *,
        run_id: typing.Optional[int] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> OrchestratorPipelineResult:
        """
        Parameters
        ----------
        task_id : str

        run_id : typing.Optional[int]

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

        Returns
        -------
        OrchestratorPipelineResult
            Successful Response

        Examples
        --------
        import asyncio

        from camb import AsyncCambApi

        client = AsyncCambApi(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.translated_tts.get_translated_tts_task_status(
                task_id="task_id",
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.get_translated_tts_task_status(
            task_id, run_id=run_id, request_options=request_options
        )
        return _response.data
