# 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.workspace import Workspace
from .raw_client import AsyncRawWorkspaceClient, RawWorkspaceClient


class WorkspaceClient:
    def __init__(self, *, client_wrapper: SyncClientWrapper):
        self._raw_client = RawWorkspaceClient(client_wrapper=client_wrapper)

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

        Returns
        -------
        RawWorkspaceClient
        """
        return self._raw_client

    def get_workspace(
        self, *, request_options: typing.Optional[RequestOptions] = None
    ) -> typing.List[Workspace]:
        """
        Get workspace details.

        Returns details about the workspace associated with the user's session.

        Returns:
            Workspace: The details of the workspace.

        Raises:
            HTTPException: If the user does not have permission to perform this action.

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

        Returns
        -------
        typing.List[Workspace]
            Successful Response

        Examples
        --------
        from agenta import AgentaApi

        client = AgentaApi(
            api_key="YOUR_API_KEY",
        )
        client.workspace.get_workspace()
        """
        _response = self._raw_client.get_workspace(request_options=request_options)
        return _response.data

    def get_all_workspace_roles(
        self, *, request_options: typing.Optional[RequestOptions] = None
    ) -> typing.List[typing.Dict[str, str]]:
        """
        Get all workspace roles.

        Returns a list of all available workspace roles.

        Returns:
            List[WorkspaceRoleResponse]: A list of WorkspaceRole objects representing the available workspace roles.

        Raises:
            HTTPException: If an error occurs while retrieving the workspace roles.

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

        Returns
        -------
        typing.List[typing.Dict[str, str]]
            Successful Response

        Examples
        --------
        from agenta import AgentaApi

        client = AgentaApi(
            api_key="YOUR_API_KEY",
        )
        client.workspace.get_all_workspace_roles()
        """
        _response = self._raw_client.get_all_workspace_roles(
            request_options=request_options
        )
        return _response.data

    def remove_user_from_workspace(
        self,
        workspace_id: str,
        *,
        email: str,
        request_options: typing.Optional[RequestOptions] = None
    ) -> typing.Optional[typing.Any]:
        """
        Remove a user from a workspace.

        Args:
            email (str): The email address of the user to be removed
            workspace_id (str): The ID of the workspace.

        Parameters
        ----------
        workspace_id : str

        email : str

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

        Returns
        -------
        typing.Optional[typing.Any]
            Successful Response

        Examples
        --------
        from agenta import AgentaApi

        client = AgentaApi(
            api_key="YOUR_API_KEY",
        )
        client.workspace.remove_user_from_workspace(
            workspace_id="workspace_id",
            email="email",
        )
        """
        _response = self._raw_client.remove_user_from_workspace(
            workspace_id, email=email, request_options=request_options
        )
        return _response.data


class AsyncWorkspaceClient:
    def __init__(self, *, client_wrapper: AsyncClientWrapper):
        self._raw_client = AsyncRawWorkspaceClient(client_wrapper=client_wrapper)

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

        Returns
        -------
        AsyncRawWorkspaceClient
        """
        return self._raw_client

    async def get_workspace(
        self, *, request_options: typing.Optional[RequestOptions] = None
    ) -> typing.List[Workspace]:
        """
        Get workspace details.

        Returns details about the workspace associated with the user's session.

        Returns:
            Workspace: The details of the workspace.

        Raises:
            HTTPException: If the user does not have permission to perform this action.

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

        Returns
        -------
        typing.List[Workspace]
            Successful Response

        Examples
        --------
        import asyncio

        from agenta import AsyncAgentaApi

        client = AsyncAgentaApi(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.workspace.get_workspace()


        asyncio.run(main())
        """
        _response = await self._raw_client.get_workspace(
            request_options=request_options
        )
        return _response.data

    async def get_all_workspace_roles(
        self, *, request_options: typing.Optional[RequestOptions] = None
    ) -> typing.List[typing.Dict[str, str]]:
        """
        Get all workspace roles.

        Returns a list of all available workspace roles.

        Returns:
            List[WorkspaceRoleResponse]: A list of WorkspaceRole objects representing the available workspace roles.

        Raises:
            HTTPException: If an error occurs while retrieving the workspace roles.

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

        Returns
        -------
        typing.List[typing.Dict[str, str]]
            Successful Response

        Examples
        --------
        import asyncio

        from agenta import AsyncAgentaApi

        client = AsyncAgentaApi(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.workspace.get_all_workspace_roles()


        asyncio.run(main())
        """
        _response = await self._raw_client.get_all_workspace_roles(
            request_options=request_options
        )
        return _response.data

    async def remove_user_from_workspace(
        self,
        workspace_id: str,
        *,
        email: str,
        request_options: typing.Optional[RequestOptions] = None
    ) -> typing.Optional[typing.Any]:
        """
        Remove a user from a workspace.

        Args:
            email (str): The email address of the user to be removed
            workspace_id (str): The ID of the workspace.

        Parameters
        ----------
        workspace_id : str

        email : str

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

        Returns
        -------
        typing.Optional[typing.Any]
            Successful Response

        Examples
        --------
        import asyncio

        from agenta import AsyncAgentaApi

        client = AsyncAgentaApi(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.workspace.remove_user_from_workspace(
                workspace_id="workspace_id",
                email="email",
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.remove_user_from_workspace(
            workspace_id, email=email, request_options=request_options
        )
        return _response.data
