# 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_text_to_voice_result_out import GetTextToVoiceResultOut
from ..types.orchestrator_pipeline_call_result import OrchestratorPipelineCallResult
from ..types.orchestrator_pipeline_result import OrchestratorPipelineResult
from .raw_client import AsyncRawTextToVoiceClient, RawTextToVoiceClient

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


class TextToVoiceClient:
    def __init__(self, *, client_wrapper: SyncClientWrapper):
        self._raw_client = RawTextToVoiceClient(client_wrapper=client_wrapper)

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

        Returns
        -------
        RawTextToVoiceClient
        """
        return self._raw_client

    def create_text_to_voice(
        self,
        *,
        text: str,
        voice_description: str,
        traceparent: typing.Optional[str] = None,
        project_name: typing.Optional[str] = OMIT,
        project_description: typing.Optional[str] = OMIT,
        folder_id: typing.Optional[int] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> OrchestratorPipelineCallResult:
        """
        Parameters
        ----------
        text : str
            The text to be converted to voice

        voice_description : str
            Description to use for the created voice

        traceparent : typing.Optional[str]

        project_name : typing.Optional[str]

        project_description : typing.Optional[str]

        folder_id : typing.Optional[int]

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

        Returns
        -------
        OrchestratorPipelineCallResult
            Successful Response

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

        client = CambApi(
            api_key="YOUR_API_KEY",
        )
        client.text_to_voice.create_text_to_voice(
            text="text",
            voice_description="voice_description",
        )
        """
        _response = self._raw_client.create_text_to_voice(
            text=text,
            voice_description=voice_description,
            traceparent=traceparent,
            project_name=project_name,
            project_description=project_description,
            folder_id=folder_id,
            request_options=request_options,
        )
        return _response.data

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

        run_id : typing.Optional[int]

        traceparent : typing.Optional[str]

        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.text_to_voice.get_text_to_voice_status(
            task_id="task_id",
        )
        """
        _response = self._raw_client.get_text_to_voice_status(
            task_id, run_id=run_id, traceparent=traceparent, request_options=request_options
        )
        return _response.data

    def get_text_to_voice_result(
        self, run_id: typing.Optional[int], *, request_options: typing.Optional[RequestOptions] = None
    ) -> GetTextToVoiceResultOut:
        """
        Parameters
        ----------
        run_id : typing.Optional[int]

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

        Returns
        -------
        GetTextToVoiceResultOut
            Successful Response

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

        client = CambApi(
            api_key="YOUR_API_KEY",
        )
        client.text_to_voice.get_text_to_voice_result(
            run_id=1,
        )
        """
        _response = self._raw_client.get_text_to_voice_result(run_id, request_options=request_options)
        return _response.data


class AsyncTextToVoiceClient:
    def __init__(self, *, client_wrapper: AsyncClientWrapper):
        self._raw_client = AsyncRawTextToVoiceClient(client_wrapper=client_wrapper)

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

        Returns
        -------
        AsyncRawTextToVoiceClient
        """
        return self._raw_client

    async def create_text_to_voice(
        self,
        *,
        text: str,
        voice_description: str,
        traceparent: typing.Optional[str] = None,
        project_name: typing.Optional[str] = OMIT,
        project_description: typing.Optional[str] = OMIT,
        folder_id: typing.Optional[int] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> OrchestratorPipelineCallResult:
        """
        Parameters
        ----------
        text : str
            The text to be converted to voice

        voice_description : str
            Description to use for the created voice

        traceparent : typing.Optional[str]

        project_name : typing.Optional[str]

        project_description : typing.Optional[str]

        folder_id : typing.Optional[int]

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

        Returns
        -------
        OrchestratorPipelineCallResult
            Successful Response

        Examples
        --------
        import asyncio

        from camb import AsyncCambApi

        client = AsyncCambApi(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.text_to_voice.create_text_to_voice(
                text="text",
                voice_description="voice_description",
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.create_text_to_voice(
            text=text,
            voice_description=voice_description,
            traceparent=traceparent,
            project_name=project_name,
            project_description=project_description,
            folder_id=folder_id,
            request_options=request_options,
        )
        return _response.data

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

        run_id : typing.Optional[int]

        traceparent : typing.Optional[str]

        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.text_to_voice.get_text_to_voice_status(
                task_id="task_id",
            )


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

    async def get_text_to_voice_result(
        self, run_id: typing.Optional[int], *, request_options: typing.Optional[RequestOptions] = None
    ) -> GetTextToVoiceResultOut:
        """
        Parameters
        ----------
        run_id : typing.Optional[int]

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

        Returns
        -------
        GetTextToVoiceResultOut
            Successful Response

        Examples
        --------
        import asyncio

        from camb import AsyncCambApi

        client = AsyncCambApi(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.text_to_voice.get_text_to_voice_result(
                run_id=1,
            )


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