# 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.copilot_config_code_theme import CopilotConfigCodeTheme
from ..types.copilot_config_fab_value import CopilotConfigFabValue
from ..types.copilot_config_mode import CopilotConfigMode
from ..types.src_handlers_create_copilot_response import SrcHandlersCreateCopilotResponse
from ..types.src_handlers_delete_copilot_response import SrcHandlersDeleteCopilotResponse
from ..types.src_handlers_get_copilot_response import SrcHandlersGetCopilotResponse
from ..types.src_handlers_list_copilots_response import SrcHandlersListCopilotsResponse
from ..types.src_handlers_update_copilot_response import SrcHandlersUpdateCopilotResponse
from .raw_client import AsyncRawCopilotsClient, RawCopilotsClient

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


class CopilotsClient:
    def __init__(self, *, client_wrapper: SyncClientWrapper):
        self._raw_client = RawCopilotsClient(client_wrapper=client_wrapper)

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

        Returns
        -------
        RawCopilotsClient
        """
        return self._raw_client

    def list(
        self,
        *,
        sort: typing.Optional[str] = None,
        direction: typing.Optional[str] = None,
        start_at: typing.Optional[str] = None,
        limit: typing.Optional[int] = None,
        query: typing.Optional[str] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> SrcHandlersListCopilotsResponse:
        """
        List all copilots in the organization

        Parameters
        ----------
        sort : typing.Optional[str]
            Field to sort by

        direction : typing.Optional[str]
            Sort in ascending or descending order

        start_at : typing.Optional[str]
            created_at to start at

        limit : typing.Optional[int]
            Limit of records to return

        query : typing.Optional[str]
            Search query

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

        Returns
        -------
        SrcHandlersListCopilotsResponse
            Successful Response

        Examples
        --------
        from scoutos import Scout

        client = Scout(
            api_key="YOUR_API_KEY",
        )
        client.copilots.list(
            sort="sort",
            direction="direction",
            start_at="start_at",
            limit=1,
            query="query",
        )
        """
        _response = self._raw_client.list(
            sort=sort, direction=direction, start_at=start_at, limit=limit, query=query, request_options=request_options
        )
        return _response.data

    def create(
        self,
        *,
        workflow_id: typing.Optional[str] = OMIT,
        img_url: typing.Optional[str] = OMIT,
        display_name: typing.Optional[str] = OMIT,
        mode: typing.Optional[CopilotConfigMode] = OMIT,
        code_theme: typing.Optional[CopilotConfigCodeTheme] = OMIT,
        colors: typing.Optional[typing.Dict[str, str]] = OMIT,
        fab: typing.Optional[typing.Dict[str, typing.Optional[CopilotConfigFabValue]]] = OMIT,
        loading_text: typing.Optional[str] = OMIT,
        message_placeholder: typing.Optional[str] = OMIT,
        initial_activity: typing.Optional[typing.Sequence[typing.Optional[typing.Any]]] = OMIT,
        allowed_origins: typing.Optional[str] = OMIT,
        powered_by: typing.Optional[str] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> SrcHandlersCreateCopilotResponse:
        """
        Parameters
        ----------
        workflow_id : typing.Optional[str]

        img_url : typing.Optional[str]

        display_name : typing.Optional[str]

        mode : typing.Optional[CopilotConfigMode]

        code_theme : typing.Optional[CopilotConfigCodeTheme]

        colors : typing.Optional[typing.Dict[str, str]]

        fab : typing.Optional[typing.Dict[str, typing.Optional[CopilotConfigFabValue]]]

        loading_text : typing.Optional[str]

        message_placeholder : typing.Optional[str]

        initial_activity : typing.Optional[typing.Sequence[typing.Optional[typing.Any]]]

        allowed_origins : typing.Optional[str]

        powered_by : typing.Optional[str]

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

        Returns
        -------
        SrcHandlersCreateCopilotResponse
            Successful Response

        Examples
        --------
        from scoutos import Scout

        client = Scout(
            api_key="YOUR_API_KEY",
        )
        client.copilots.create()
        """
        _response = self._raw_client.create(
            workflow_id=workflow_id,
            img_url=img_url,
            display_name=display_name,
            mode=mode,
            code_theme=code_theme,
            colors=colors,
            fab=fab,
            loading_text=loading_text,
            message_placeholder=message_placeholder,
            initial_activity=initial_activity,
            allowed_origins=allowed_origins,
            powered_by=powered_by,
            request_options=request_options,
        )
        return _response.data

    def get(
        self, copilot_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> SrcHandlersGetCopilotResponse:
        """
        Fetch copilot configuration by ID.

        Parameters
        ----------
        copilot_id : str

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

        Returns
        -------
        SrcHandlersGetCopilotResponse
            Successful Response

        Examples
        --------
        from scoutos import Scout

        client = Scout(
            api_key="YOUR_API_KEY",
        )
        client.copilots.get(
            copilot_id="copilot_id",
        )
        """
        _response = self._raw_client.get(copilot_id, request_options=request_options)
        return _response.data

    def update(
        self,
        copilot_id: str,
        *,
        workflow_id: typing.Optional[str] = OMIT,
        img_url: typing.Optional[str] = OMIT,
        display_name: typing.Optional[str] = OMIT,
        mode: typing.Optional[CopilotConfigMode] = OMIT,
        code_theme: typing.Optional[CopilotConfigCodeTheme] = OMIT,
        colors: typing.Optional[typing.Dict[str, str]] = OMIT,
        fab: typing.Optional[typing.Dict[str, typing.Optional[CopilotConfigFabValue]]] = OMIT,
        loading_text: typing.Optional[str] = OMIT,
        message_placeholder: typing.Optional[str] = OMIT,
        initial_activity: typing.Optional[typing.Sequence[typing.Optional[typing.Any]]] = OMIT,
        allowed_origins: typing.Optional[str] = OMIT,
        powered_by: typing.Optional[str] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> SrcHandlersUpdateCopilotResponse:
        """
        Parameters
        ----------
        copilot_id : str

        workflow_id : typing.Optional[str]

        img_url : typing.Optional[str]

        display_name : typing.Optional[str]

        mode : typing.Optional[CopilotConfigMode]

        code_theme : typing.Optional[CopilotConfigCodeTheme]

        colors : typing.Optional[typing.Dict[str, str]]

        fab : typing.Optional[typing.Dict[str, typing.Optional[CopilotConfigFabValue]]]

        loading_text : typing.Optional[str]

        message_placeholder : typing.Optional[str]

        initial_activity : typing.Optional[typing.Sequence[typing.Optional[typing.Any]]]

        allowed_origins : typing.Optional[str]

        powered_by : typing.Optional[str]

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

        Returns
        -------
        SrcHandlersUpdateCopilotResponse
            Successful Response

        Examples
        --------
        from scoutos import Scout

        client = Scout(
            api_key="YOUR_API_KEY",
        )
        client.copilots.update(
            copilot_id="copilot_id",
        )
        """
        _response = self._raw_client.update(
            copilot_id,
            workflow_id=workflow_id,
            img_url=img_url,
            display_name=display_name,
            mode=mode,
            code_theme=code_theme,
            colors=colors,
            fab=fab,
            loading_text=loading_text,
            message_placeholder=message_placeholder,
            initial_activity=initial_activity,
            allowed_origins=allowed_origins,
            powered_by=powered_by,
            request_options=request_options,
        )
        return _response.data

    def delete(
        self, copilot_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> SrcHandlersDeleteCopilotResponse:
        """
        Parameters
        ----------
        copilot_id : str

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

        Returns
        -------
        SrcHandlersDeleteCopilotResponse
            Successful Response

        Examples
        --------
        from scoutos import Scout

        client = Scout(
            api_key="YOUR_API_KEY",
        )
        client.copilots.delete(
            copilot_id="copilot_id",
        )
        """
        _response = self._raw_client.delete(copilot_id, request_options=request_options)
        return _response.data


class AsyncCopilotsClient:
    def __init__(self, *, client_wrapper: AsyncClientWrapper):
        self._raw_client = AsyncRawCopilotsClient(client_wrapper=client_wrapper)

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

        Returns
        -------
        AsyncRawCopilotsClient
        """
        return self._raw_client

    async def list(
        self,
        *,
        sort: typing.Optional[str] = None,
        direction: typing.Optional[str] = None,
        start_at: typing.Optional[str] = None,
        limit: typing.Optional[int] = None,
        query: typing.Optional[str] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> SrcHandlersListCopilotsResponse:
        """
        List all copilots in the organization

        Parameters
        ----------
        sort : typing.Optional[str]
            Field to sort by

        direction : typing.Optional[str]
            Sort in ascending or descending order

        start_at : typing.Optional[str]
            created_at to start at

        limit : typing.Optional[int]
            Limit of records to return

        query : typing.Optional[str]
            Search query

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

        Returns
        -------
        SrcHandlersListCopilotsResponse
            Successful Response

        Examples
        --------
        import asyncio

        from scoutos import AsyncScout

        client = AsyncScout(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.copilots.list(
                sort="sort",
                direction="direction",
                start_at="start_at",
                limit=1,
                query="query",
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.list(
            sort=sort, direction=direction, start_at=start_at, limit=limit, query=query, request_options=request_options
        )
        return _response.data

    async def create(
        self,
        *,
        workflow_id: typing.Optional[str] = OMIT,
        img_url: typing.Optional[str] = OMIT,
        display_name: typing.Optional[str] = OMIT,
        mode: typing.Optional[CopilotConfigMode] = OMIT,
        code_theme: typing.Optional[CopilotConfigCodeTheme] = OMIT,
        colors: typing.Optional[typing.Dict[str, str]] = OMIT,
        fab: typing.Optional[typing.Dict[str, typing.Optional[CopilotConfigFabValue]]] = OMIT,
        loading_text: typing.Optional[str] = OMIT,
        message_placeholder: typing.Optional[str] = OMIT,
        initial_activity: typing.Optional[typing.Sequence[typing.Optional[typing.Any]]] = OMIT,
        allowed_origins: typing.Optional[str] = OMIT,
        powered_by: typing.Optional[str] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> SrcHandlersCreateCopilotResponse:
        """
        Parameters
        ----------
        workflow_id : typing.Optional[str]

        img_url : typing.Optional[str]

        display_name : typing.Optional[str]

        mode : typing.Optional[CopilotConfigMode]

        code_theme : typing.Optional[CopilotConfigCodeTheme]

        colors : typing.Optional[typing.Dict[str, str]]

        fab : typing.Optional[typing.Dict[str, typing.Optional[CopilotConfigFabValue]]]

        loading_text : typing.Optional[str]

        message_placeholder : typing.Optional[str]

        initial_activity : typing.Optional[typing.Sequence[typing.Optional[typing.Any]]]

        allowed_origins : typing.Optional[str]

        powered_by : typing.Optional[str]

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

        Returns
        -------
        SrcHandlersCreateCopilotResponse
            Successful Response

        Examples
        --------
        import asyncio

        from scoutos import AsyncScout

        client = AsyncScout(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.copilots.create()


        asyncio.run(main())
        """
        _response = await self._raw_client.create(
            workflow_id=workflow_id,
            img_url=img_url,
            display_name=display_name,
            mode=mode,
            code_theme=code_theme,
            colors=colors,
            fab=fab,
            loading_text=loading_text,
            message_placeholder=message_placeholder,
            initial_activity=initial_activity,
            allowed_origins=allowed_origins,
            powered_by=powered_by,
            request_options=request_options,
        )
        return _response.data

    async def get(
        self, copilot_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> SrcHandlersGetCopilotResponse:
        """
        Fetch copilot configuration by ID.

        Parameters
        ----------
        copilot_id : str

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

        Returns
        -------
        SrcHandlersGetCopilotResponse
            Successful Response

        Examples
        --------
        import asyncio

        from scoutos import AsyncScout

        client = AsyncScout(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.copilots.get(
                copilot_id="copilot_id",
            )


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

    async def update(
        self,
        copilot_id: str,
        *,
        workflow_id: typing.Optional[str] = OMIT,
        img_url: typing.Optional[str] = OMIT,
        display_name: typing.Optional[str] = OMIT,
        mode: typing.Optional[CopilotConfigMode] = OMIT,
        code_theme: typing.Optional[CopilotConfigCodeTheme] = OMIT,
        colors: typing.Optional[typing.Dict[str, str]] = OMIT,
        fab: typing.Optional[typing.Dict[str, typing.Optional[CopilotConfigFabValue]]] = OMIT,
        loading_text: typing.Optional[str] = OMIT,
        message_placeholder: typing.Optional[str] = OMIT,
        initial_activity: typing.Optional[typing.Sequence[typing.Optional[typing.Any]]] = OMIT,
        allowed_origins: typing.Optional[str] = OMIT,
        powered_by: typing.Optional[str] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> SrcHandlersUpdateCopilotResponse:
        """
        Parameters
        ----------
        copilot_id : str

        workflow_id : typing.Optional[str]

        img_url : typing.Optional[str]

        display_name : typing.Optional[str]

        mode : typing.Optional[CopilotConfigMode]

        code_theme : typing.Optional[CopilotConfigCodeTheme]

        colors : typing.Optional[typing.Dict[str, str]]

        fab : typing.Optional[typing.Dict[str, typing.Optional[CopilotConfigFabValue]]]

        loading_text : typing.Optional[str]

        message_placeholder : typing.Optional[str]

        initial_activity : typing.Optional[typing.Sequence[typing.Optional[typing.Any]]]

        allowed_origins : typing.Optional[str]

        powered_by : typing.Optional[str]

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

        Returns
        -------
        SrcHandlersUpdateCopilotResponse
            Successful Response

        Examples
        --------
        import asyncio

        from scoutos import AsyncScout

        client = AsyncScout(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.copilots.update(
                copilot_id="copilot_id",
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.update(
            copilot_id,
            workflow_id=workflow_id,
            img_url=img_url,
            display_name=display_name,
            mode=mode,
            code_theme=code_theme,
            colors=colors,
            fab=fab,
            loading_text=loading_text,
            message_placeholder=message_placeholder,
            initial_activity=initial_activity,
            allowed_origins=allowed_origins,
            powered_by=powered_by,
            request_options=request_options,
        )
        return _response.data

    async def delete(
        self, copilot_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> SrcHandlersDeleteCopilotResponse:
        """
        Parameters
        ----------
        copilot_id : str

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

        Returns
        -------
        SrcHandlersDeleteCopilotResponse
            Successful Response

        Examples
        --------
        import asyncio

        from scoutos import AsyncScout

        client = AsyncScout(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.copilots.delete(
                copilot_id="copilot_id",
            )


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