# 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.procedure_draft_response_model import ProcedureDraftResponseModel
from .....types.procedure_type import ProcedureType
from .raw_client import AsyncRawDraftsClient, RawDraftsClient

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


class DraftsClient:
    def __init__(self, *, client_wrapper: SyncClientWrapper):
        self._raw_client = RawDraftsClient(client_wrapper=client_wrapper)

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

        Returns
        -------
        RawDraftsClient
        """
        return self._raw_client

    def get(
        self,
        agent_id: str,
        branch_id: str,
        procedure_id: str,
        *,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> ProcedureDraftResponseModel:
        """
        Get user's draft for a procedure

        Parameters
        ----------
        agent_id : str
            Agent ID to get the procedure draft from

        branch_id : str
            Branch ID to get the procedure draft from

        procedure_id : str
            The procedure ID

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

        Returns
        -------
        ProcedureDraftResponseModel
            Successful Response

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

        client = ElevenLabs(
            api_key="YOUR_API_KEY",
        )
        client.conversational_ai.agents.procedures.drafts.get(
            agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz",
            branch_id="agtbranch_0901k4aafjxxfxt93gd841r7tv5t",
            procedure_id="agtprc_6qbpwdq8n01bxhk44bgjy6f10ck3",
        )
        """
        _response = self._raw_client.get(agent_id, branch_id, procedure_id, request_options=request_options)
        return _response.data

    def delete(
        self,
        agent_id: str,
        branch_id: str,
        procedure_id: str,
        *,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> typing.Any:
        """
        Delete user's draft for a procedure, resetting to the committed version

        Parameters
        ----------
        agent_id : str
            Agent ID to get the procedure draft from

        branch_id : str
            Branch ID to get the procedure draft from

        procedure_id : str
            The procedure ID

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

        Returns
        -------
        typing.Any
            Successful Response

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

        client = ElevenLabs(
            api_key="YOUR_API_KEY",
        )
        client.conversational_ai.agents.procedures.drafts.delete(
            agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz",
            branch_id="agtbranch_0901k4aafjxxfxt93gd841r7tv5t",
            procedure_id="agtprc_6qbpwdq8n01bxhk44bgjy6f10ck3",
        )
        """
        _response = self._raw_client.delete(agent_id, branch_id, procedure_id, request_options=request_options)
        return _response.data

    def update(
        self,
        agent_id: str,
        branch_id: str,
        procedure_id: str,
        *,
        name: str,
        content: str,
        type: ProcedureType,
        trigger: typing.Optional[str] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> ProcedureDraftResponseModel:
        """
        Create or update user's draft for a procedure

        Parameters
        ----------
        agent_id : str
            Agent ID to get the procedure draft from

        branch_id : str
            Branch ID to get the procedure draft from

        procedure_id : str
            The procedure ID

        name : str
            Procedure name

        content : str
            Procedure content

        type : ProcedureType
            Procedure type

        trigger : typing.Optional[str]
            When the agent should use this procedure. Empty string means this is a sub-procedure that should only start when another procedure references it. If omitted or null, the trigger is derived from the content instead. Also accepts `description` as an alias.

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

        Returns
        -------
        ProcedureDraftResponseModel
            Successful Response

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

        client = ElevenLabs(
            api_key="YOUR_API_KEY",
        )
        client.conversational_ai.agents.procedures.drafts.update(
            agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz",
            branch_id="agtbranch_0901k4aafjxxfxt93gd841r7tv5t",
            procedure_id="agtprc_6qbpwdq8n01bxhk44bgjy6f10ck3",
            name="name",
            content="content",
            type="free_form",
        )
        """
        _response = self._raw_client.update(
            agent_id,
            branch_id,
            procedure_id,
            name=name,
            content=content,
            type=type,
            trigger=trigger,
            request_options=request_options,
        )
        return _response.data


class AsyncDraftsClient:
    def __init__(self, *, client_wrapper: AsyncClientWrapper):
        self._raw_client = AsyncRawDraftsClient(client_wrapper=client_wrapper)

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

        Returns
        -------
        AsyncRawDraftsClient
        """
        return self._raw_client

    async def get(
        self,
        agent_id: str,
        branch_id: str,
        procedure_id: str,
        *,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> ProcedureDraftResponseModel:
        """
        Get user's draft for a procedure

        Parameters
        ----------
        agent_id : str
            Agent ID to get the procedure draft from

        branch_id : str
            Branch ID to get the procedure draft from

        procedure_id : str
            The procedure ID

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

        Returns
        -------
        ProcedureDraftResponseModel
            Successful Response

        Examples
        --------
        import asyncio

        from elevenlabs import AsyncElevenLabs

        client = AsyncElevenLabs(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.conversational_ai.agents.procedures.drafts.get(
                agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz",
                branch_id="agtbranch_0901k4aafjxxfxt93gd841r7tv5t",
                procedure_id="agtprc_6qbpwdq8n01bxhk44bgjy6f10ck3",
            )


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

    async def delete(
        self,
        agent_id: str,
        branch_id: str,
        procedure_id: str,
        *,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> typing.Any:
        """
        Delete user's draft for a procedure, resetting to the committed version

        Parameters
        ----------
        agent_id : str
            Agent ID to get the procedure draft from

        branch_id : str
            Branch ID to get the procedure draft from

        procedure_id : str
            The procedure ID

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

        Returns
        -------
        typing.Any
            Successful Response

        Examples
        --------
        import asyncio

        from elevenlabs import AsyncElevenLabs

        client = AsyncElevenLabs(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.conversational_ai.agents.procedures.drafts.delete(
                agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz",
                branch_id="agtbranch_0901k4aafjxxfxt93gd841r7tv5t",
                procedure_id="agtprc_6qbpwdq8n01bxhk44bgjy6f10ck3",
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.delete(agent_id, branch_id, procedure_id, request_options=request_options)
        return _response.data

    async def update(
        self,
        agent_id: str,
        branch_id: str,
        procedure_id: str,
        *,
        name: str,
        content: str,
        type: ProcedureType,
        trigger: typing.Optional[str] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> ProcedureDraftResponseModel:
        """
        Create or update user's draft for a procedure

        Parameters
        ----------
        agent_id : str
            Agent ID to get the procedure draft from

        branch_id : str
            Branch ID to get the procedure draft from

        procedure_id : str
            The procedure ID

        name : str
            Procedure name

        content : str
            Procedure content

        type : ProcedureType
            Procedure type

        trigger : typing.Optional[str]
            When the agent should use this procedure. Empty string means this is a sub-procedure that should only start when another procedure references it. If omitted or null, the trigger is derived from the content instead. Also accepts `description` as an alias.

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

        Returns
        -------
        ProcedureDraftResponseModel
            Successful Response

        Examples
        --------
        import asyncio

        from elevenlabs import AsyncElevenLabs

        client = AsyncElevenLabs(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.conversational_ai.agents.procedures.drafts.update(
                agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz",
                branch_id="agtbranch_0901k4aafjxxfxt93gd841r7tv5t",
                procedure_id="agtprc_6qbpwdq8n01bxhk44bgjy6f10ck3",
                name="name",
                content="content",
                type="free_form",
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.update(
            agent_id,
            branch_id,
            procedure_id,
            name=name,
            content=content,
            type=type,
            trigger=trigger,
            request_options=request_options,
        )
        return _response.data
