# 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 .raw_client import AsyncRawAgentsClient, RawAgentsClient
from .types.fetch_response_agents_response import FetchResponseAgentsResponse
from .types.send_message_agents_request_conversation import SendMessageAgentsRequestConversation
from .types.send_message_agents_response import SendMessageAgentsResponse

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


class AgentsClient:
    def __init__(self, *, client_wrapper: SyncClientWrapper):
        self._raw_client = RawAgentsClient(client_wrapper=client_wrapper)

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

        Returns
        -------
        RawAgentsClient
        """
        return self._raw_client

    def send_message(
        self,
        *,
        agent_id: str,
        conversation: SendMessageAgentsRequestConversation,
        message: str,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> SendMessageAgentsResponse:
        """
        Parameters
        ----------
        agent_id : str

        conversation : SendMessageAgentsRequestConversation

        message : str

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

        Returns
        -------
        SendMessageAgentsResponse
            Message sent successfully

        Examples
        --------
        from credal import CredalApi
        from credal.agents import SendMessageAgentsRequestConversation_New

        client = CredalApi(
            token="YOUR_TOKEN",
        )
        client.agents.send_message(
            agent_id="cc3fd192-ea62-11f0-99fd-03d6b2458fff",
            conversation=SendMessageAgentsRequestConversation_New(),
            message="What documents do we have about Q4 planning?",
        )
        """
        _response = self._raw_client.send_message(
            agent_id=agent_id, conversation=conversation, message=message, request_options=request_options
        )
        return _response.data

    def fetch_response(
        self, *, job_id: str, request_options: typing.Optional[RequestOptions] = None
    ) -> FetchResponseAgentsResponse:
        """
        Parameters
        ----------
        job_id : str

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

        Returns
        -------
        FetchResponseAgentsResponse
            Agent response status

        Examples
        --------
        from credal import CredalApi

        client = CredalApi(
            token="YOUR_TOKEN",
        )
        client.agents.fetch_response(
            job_id="jobId",
        )
        """
        _response = self._raw_client.fetch_response(job_id=job_id, request_options=request_options)
        return _response.data


class AsyncAgentsClient:
    def __init__(self, *, client_wrapper: AsyncClientWrapper):
        self._raw_client = AsyncRawAgentsClient(client_wrapper=client_wrapper)

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

        Returns
        -------
        AsyncRawAgentsClient
        """
        return self._raw_client

    async def send_message(
        self,
        *,
        agent_id: str,
        conversation: SendMessageAgentsRequestConversation,
        message: str,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> SendMessageAgentsResponse:
        """
        Parameters
        ----------
        agent_id : str

        conversation : SendMessageAgentsRequestConversation

        message : str

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

        Returns
        -------
        SendMessageAgentsResponse
            Message sent successfully

        Examples
        --------
        import asyncio

        from credal import AsyncCredalApi
        from credal.agents import SendMessageAgentsRequestConversation_New

        client = AsyncCredalApi(
            token="YOUR_TOKEN",
        )


        async def main() -> None:
            await client.agents.send_message(
                agent_id="cc3fd192-ea62-11f0-99fd-03d6b2458fff",
                conversation=SendMessageAgentsRequestConversation_New(),
                message="What documents do we have about Q4 planning?",
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.send_message(
            agent_id=agent_id, conversation=conversation, message=message, request_options=request_options
        )
        return _response.data

    async def fetch_response(
        self, *, job_id: str, request_options: typing.Optional[RequestOptions] = None
    ) -> FetchResponseAgentsResponse:
        """
        Parameters
        ----------
        job_id : str

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

        Returns
        -------
        FetchResponseAgentsResponse
            Agent response status

        Examples
        --------
        import asyncio

        from credal import AsyncCredalApi

        client = AsyncCredalApi(
            token="YOUR_TOKEN",
        )


        async def main() -> None:
            await client.agents.fetch_response(
                job_id="jobId",
            )


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