# 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_project_invite_v1response import CreateProjectInviteV1Response
from ......types.delete_project_invite_v1response import DeleteProjectInviteV1Response
from ......types.list_project_invites_v1response import ListProjectInvitesV1Response
from .raw_client import AsyncRawInvitesClient, RawInvitesClient

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


class InvitesClient:
    def __init__(self, *, client_wrapper: SyncClientWrapper):
        self._raw_client = RawInvitesClient(client_wrapper=client_wrapper)

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

        Returns
        -------
        RawInvitesClient
        """
        return self._raw_client

    def list(
        self, project_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> ListProjectInvitesV1Response:
        """
        Generates a list of invites for a specific project

        Parameters
        ----------
        project_id : str
            The unique identifier of the project

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

        Returns
        -------
        ListProjectInvitesV1Response
            A list of invites for a specific project

        Examples
        --------
        from deepgram import DeepgramClient

        client = DeepgramClient(
            api_key="YOUR_API_KEY",
        )
        client.manage.v1.projects.members.invites.list(
            project_id="123456-7890-1234-5678-901234",
        )
        """
        _response = self._raw_client.list(project_id, request_options=request_options)
        return _response.data

    def create(
        self, project_id: str, *, email: str, scope: str, request_options: typing.Optional[RequestOptions] = None
    ) -> CreateProjectInviteV1Response:
        """
        Generates an invite for a specific project

        Parameters
        ----------
        project_id : str
            The unique identifier of the project

        email : str
            The email address of the invitee

        scope : str
            The scope of the invitee

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

        Returns
        -------
        CreateProjectInviteV1Response
            The invite was successfully generated

        Examples
        --------
        from deepgram import DeepgramClient

        client = DeepgramClient(
            api_key="YOUR_API_KEY",
        )
        client.manage.v1.projects.members.invites.create(
            project_id="123456-7890-1234-5678-901234",
            email="email",
            scope="scope",
        )
        """
        _response = self._raw_client.create(project_id, email=email, scope=scope, request_options=request_options)
        return _response.data

    def delete(
        self, project_id: str, email: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> DeleteProjectInviteV1Response:
        """
        Deletes an invite for a specific project

        Parameters
        ----------
        project_id : str
            The unique identifier of the project

        email : str
            The email address of the member

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

        Returns
        -------
        DeleteProjectInviteV1Response
            The invite was successfully deleted

        Examples
        --------
        from deepgram import DeepgramClient

        client = DeepgramClient(
            api_key="YOUR_API_KEY",
        )
        client.manage.v1.projects.members.invites.delete(
            project_id="123456-7890-1234-5678-901234",
            email="john.doe@example.com",
        )
        """
        _response = self._raw_client.delete(project_id, email, request_options=request_options)
        return _response.data


class AsyncInvitesClient:
    def __init__(self, *, client_wrapper: AsyncClientWrapper):
        self._raw_client = AsyncRawInvitesClient(client_wrapper=client_wrapper)

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

        Returns
        -------
        AsyncRawInvitesClient
        """
        return self._raw_client

    async def list(
        self, project_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> ListProjectInvitesV1Response:
        """
        Generates a list of invites for a specific project

        Parameters
        ----------
        project_id : str
            The unique identifier of the project

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

        Returns
        -------
        ListProjectInvitesV1Response
            A list of invites for a specific project

        Examples
        --------
        import asyncio

        from deepgram import AsyncDeepgramClient

        client = AsyncDeepgramClient(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.manage.v1.projects.members.invites.list(
                project_id="123456-7890-1234-5678-901234",
            )


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

    async def create(
        self, project_id: str, *, email: str, scope: str, request_options: typing.Optional[RequestOptions] = None
    ) -> CreateProjectInviteV1Response:
        """
        Generates an invite for a specific project

        Parameters
        ----------
        project_id : str
            The unique identifier of the project

        email : str
            The email address of the invitee

        scope : str
            The scope of the invitee

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

        Returns
        -------
        CreateProjectInviteV1Response
            The invite was successfully generated

        Examples
        --------
        import asyncio

        from deepgram import AsyncDeepgramClient

        client = AsyncDeepgramClient(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.manage.v1.projects.members.invites.create(
                project_id="123456-7890-1234-5678-901234",
                email="email",
                scope="scope",
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.create(project_id, email=email, scope=scope, request_options=request_options)
        return _response.data

    async def delete(
        self, project_id: str, email: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> DeleteProjectInviteV1Response:
        """
        Deletes an invite for a specific project

        Parameters
        ----------
        project_id : str
            The unique identifier of the project

        email : str
            The email address of the member

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

        Returns
        -------
        DeleteProjectInviteV1Response
            The invite was successfully deleted

        Examples
        --------
        import asyncio

        from deepgram import AsyncDeepgramClient

        client = AsyncDeepgramClient(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.manage.v1.projects.members.invites.delete(
                project_id="123456-7890-1234-5678-901234",
                email="john.doe@example.com",
            )


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