# 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_agent_test_folder_response_model import CreateAgentTestFolderResponseModel
from ....types.get_agent_test_folder_response_model import GetAgentTestFolderResponseModel
from .raw_client import AsyncRawFoldersClient, RawFoldersClient

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


class FoldersClient:
    def __init__(self, *, client_wrapper: SyncClientWrapper):
        self._raw_client = RawFoldersClient(client_wrapper=client_wrapper)

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

        Returns
        -------
        RawFoldersClient
        """
        return self._raw_client

    def create(
        self,
        *,
        name: str,
        parent_folder_id: typing.Optional[str] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> CreateAgentTestFolderResponseModel:
        """
        Creates a folder for organizing agent tests.

        Parameters
        ----------
        name : str
            The name of the folder to create

        parent_folder_id : typing.Optional[str]
            The ID of the parent folder. If not provided, the folder will be created at the root level.

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

        Returns
        -------
        CreateAgentTestFolderResponseModel
            Folder successfully created

        Examples
        --------
        from elevenlabs import ElevenLabs

        client = ElevenLabs(
            api_key="YOUR_API_KEY",
        )
        client.conversational_ai.tests.folders.create(
            name="name",
        )
        """
        _response = self._raw_client.create(
            name=name, parent_folder_id=parent_folder_id, request_options=request_options
        )
        return _response.data

    def get(
        self, folder_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> GetAgentTestFolderResponseModel:
        """
        Gets an agent test folder by ID, including its folder path.

        Parameters
        ----------
        folder_id : str
            The folder ID.

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

        Returns
        -------
        GetAgentTestFolderResponseModel
            Folder details retrieved successfully

        Examples
        --------
        from elevenlabs import ElevenLabs

        client = ElevenLabs(
            api_key="YOUR_API_KEY",
        )
        client.conversational_ai.tests.folders.get(
            folder_id="tfld_7301khxdkycse5f88fzjdtrterzm",
        )
        """
        _response = self._raw_client.get(folder_id, request_options=request_options)
        return _response.data

    def delete(
        self,
        folder_id: str,
        *,
        force: typing.Optional[bool] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> None:
        """
        Deletes an agent test folder by ID. Use force=true to delete a non-empty folder and all its contents.

        Parameters
        ----------
        folder_id : str
            The folder ID.

        force : typing.Optional[bool]
            Force delete. Required for deleting non-empty folders.

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

        Returns
        -------
        None

        Examples
        --------
        from elevenlabs import ElevenLabs

        client = ElevenLabs(
            api_key="YOUR_API_KEY",
        )
        client.conversational_ai.tests.folders.delete(
            folder_id="tfld_7301khxdkycse5f88fzjdtrterzm",
            force=True,
        )
        """
        _response = self._raw_client.delete(folder_id, force=force, request_options=request_options)
        return _response.data

    def update(
        self, folder_id: str, *, name: str, request_options: typing.Optional[RequestOptions] = None
    ) -> GetAgentTestFolderResponseModel:
        """
        Updates an agent test folder. Currently only supports updating the folder name.

        Parameters
        ----------
        folder_id : str
            The folder ID.

        name : str
            The new name for the folder

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

        Returns
        -------
        GetAgentTestFolderResponseModel
            Folder successfully updated

        Examples
        --------
        from elevenlabs import ElevenLabs

        client = ElevenLabs(
            api_key="YOUR_API_KEY",
        )
        client.conversational_ai.tests.folders.update(
            folder_id="tfld_7301khxdkycse5f88fzjdtrterzm",
            name="name",
        )
        """
        _response = self._raw_client.update(folder_id, name=name, request_options=request_options)
        return _response.data


class AsyncFoldersClient:
    def __init__(self, *, client_wrapper: AsyncClientWrapper):
        self._raw_client = AsyncRawFoldersClient(client_wrapper=client_wrapper)

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

        Returns
        -------
        AsyncRawFoldersClient
        """
        return self._raw_client

    async def create(
        self,
        *,
        name: str,
        parent_folder_id: typing.Optional[str] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> CreateAgentTestFolderResponseModel:
        """
        Creates a folder for organizing agent tests.

        Parameters
        ----------
        name : str
            The name of the folder to create

        parent_folder_id : typing.Optional[str]
            The ID of the parent folder. If not provided, the folder will be created at the root level.

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

        Returns
        -------
        CreateAgentTestFolderResponseModel
            Folder successfully created

        Examples
        --------
        import asyncio

        from elevenlabs import AsyncElevenLabs

        client = AsyncElevenLabs(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.conversational_ai.tests.folders.create(
                name="name",
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.create(
            name=name, parent_folder_id=parent_folder_id, request_options=request_options
        )
        return _response.data

    async def get(
        self, folder_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> GetAgentTestFolderResponseModel:
        """
        Gets an agent test folder by ID, including its folder path.

        Parameters
        ----------
        folder_id : str
            The folder ID.

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

        Returns
        -------
        GetAgentTestFolderResponseModel
            Folder details retrieved successfully

        Examples
        --------
        import asyncio

        from elevenlabs import AsyncElevenLabs

        client = AsyncElevenLabs(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.conversational_ai.tests.folders.get(
                folder_id="tfld_7301khxdkycse5f88fzjdtrterzm",
            )


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

    async def delete(
        self,
        folder_id: str,
        *,
        force: typing.Optional[bool] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> None:
        """
        Deletes an agent test folder by ID. Use force=true to delete a non-empty folder and all its contents.

        Parameters
        ----------
        folder_id : str
            The folder ID.

        force : typing.Optional[bool]
            Force delete. Required for deleting non-empty folders.

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

        Returns
        -------
        None

        Examples
        --------
        import asyncio

        from elevenlabs import AsyncElevenLabs

        client = AsyncElevenLabs(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.conversational_ai.tests.folders.delete(
                folder_id="tfld_7301khxdkycse5f88fzjdtrterzm",
                force=True,
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.delete(folder_id, force=force, request_options=request_options)
        return _response.data

    async def update(
        self, folder_id: str, *, name: str, request_options: typing.Optional[RequestOptions] = None
    ) -> GetAgentTestFolderResponseModel:
        """
        Updates an agent test folder. Currently only supports updating the folder name.

        Parameters
        ----------
        folder_id : str
            The folder ID.

        name : str
            The new name for the folder

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

        Returns
        -------
        GetAgentTestFolderResponseModel
            Folder successfully updated

        Examples
        --------
        import asyncio

        from elevenlabs import AsyncElevenLabs

        client = AsyncElevenLabs(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.conversational_ai.tests.folders.update(
                folder_id="tfld_7301khxdkycse5f88fzjdtrterzm",
                name="name",
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.update(folder_id, name=name, request_options=request_options)
        return _response.data
