# 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 (
    AsyncRawOrganizationInvitationsClient,
    RawOrganizationInvitationsClient,
)
from .types.organization_invitations_accept_response import (
    OrganizationInvitationsAcceptResponse,
)
from .types.organization_invitations_create_request_role import (
    OrganizationInvitationsCreateRequestRole,
)
from .types.organization_invitations_create_response import (
    OrganizationInvitationsCreateResponse,
)
from .types.organization_invitations_get_response import (
    OrganizationInvitationsGetResponse,
)
from .types.organization_invitations_list_response_item import (
    OrganizationInvitationsListResponseItem,
)

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


class OrganizationInvitationsClient:
    def __init__(self, *, client_wrapper: SyncClientWrapper):
        self._raw_client = RawOrganizationInvitationsClient(
            client_wrapper=client_wrapper
        )

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

        Returns
        -------
        RawOrganizationInvitationsClient
        """
        return self._raw_client

    def list(
        self,
        organization_id: str,
        *,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> typing.List[OrganizationInvitationsListResponseItem]:
        """
        Parameters
        ----------
        organization_id : str

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

        Returns
        -------
        typing.List[OrganizationInvitationsListResponseItem]
            Success

        Examples
        --------
        from mirascope.api._generated import Mirascope

        client = Mirascope()
        client.organization_invitations.list(
            organization_id="organizationId",
        )
        """
        _response = self._raw_client.list(
            organization_id, request_options=request_options
        )
        return _response.data

    def create(
        self,
        organization_id: str,
        *,
        recipient_email: str,
        role: OrganizationInvitationsCreateRequestRole,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> OrganizationInvitationsCreateResponse:
        """
        Parameters
        ----------
        organization_id : str

        recipient_email : str
            a string matching the pattern ^[^ \t\n\r\f\v@]+@[^ \t\n\r\f\v@]+[.][^ \t\n\r\f\v@]+$

        role : OrganizationInvitationsCreateRequestRole

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

        Returns
        -------
        OrganizationInvitationsCreateResponse
            Success

        Examples
        --------
        from mirascope.api._generated import Mirascope

        client = Mirascope()
        client.organization_invitations.create(
            organization_id="organizationId",
            recipient_email="recipientEmail",
            role="ADMIN",
        )
        """
        _response = self._raw_client.create(
            organization_id,
            recipient_email=recipient_email,
            role=role,
            request_options=request_options,
        )
        return _response.data

    def get(
        self,
        organization_id: str,
        invitation_id: str,
        *,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> OrganizationInvitationsGetResponse:
        """
        Parameters
        ----------
        organization_id : str

        invitation_id : str

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

        Returns
        -------
        OrganizationInvitationsGetResponse
            Success

        Examples
        --------
        from mirascope.api._generated import Mirascope

        client = Mirascope()
        client.organization_invitations.get(
            organization_id="organizationId",
            invitation_id="invitationId",
        )
        """
        _response = self._raw_client.get(
            organization_id, invitation_id, request_options=request_options
        )
        return _response.data

    def resend(
        self,
        organization_id: str,
        invitation_id: str,
        *,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> None:
        """
        Parameters
        ----------
        organization_id : str

        invitation_id : str

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

        Returns
        -------
        None

        Examples
        --------
        from mirascope.api._generated import Mirascope

        client = Mirascope()
        client.organization_invitations.resend(
            organization_id="organizationId",
            invitation_id="invitationId",
        )
        """
        _response = self._raw_client.resend(
            organization_id, invitation_id, request_options=request_options
        )
        return _response.data

    def revoke(
        self,
        organization_id: str,
        invitation_id: str,
        *,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> None:
        """
        Parameters
        ----------
        organization_id : str

        invitation_id : str

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

        Returns
        -------
        None

        Examples
        --------
        from mirascope.api._generated import Mirascope

        client = Mirascope()
        client.organization_invitations.revoke(
            organization_id="organizationId",
            invitation_id="invitationId",
        )
        """
        _response = self._raw_client.revoke(
            organization_id, invitation_id, request_options=request_options
        )
        return _response.data

    def accept(
        self, *, token: str, request_options: typing.Optional[RequestOptions] = None
    ) -> OrganizationInvitationsAcceptResponse:
        """
        Parameters
        ----------
        token : str

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

        Returns
        -------
        OrganizationInvitationsAcceptResponse
            Success

        Examples
        --------
        from mirascope.api._generated import Mirascope

        client = Mirascope()
        client.organization_invitations.accept(
            token="token",
        )
        """
        _response = self._raw_client.accept(
            token=token, request_options=request_options
        )
        return _response.data


class AsyncOrganizationInvitationsClient:
    def __init__(self, *, client_wrapper: AsyncClientWrapper):
        self._raw_client = AsyncRawOrganizationInvitationsClient(
            client_wrapper=client_wrapper
        )

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

        Returns
        -------
        AsyncRawOrganizationInvitationsClient
        """
        return self._raw_client

    async def list(
        self,
        organization_id: str,
        *,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> typing.List[OrganizationInvitationsListResponseItem]:
        """
        Parameters
        ----------
        organization_id : str

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

        Returns
        -------
        typing.List[OrganizationInvitationsListResponseItem]
            Success

        Examples
        --------
        import asyncio

        from mirascope.api._generated import AsyncMirascope

        client = AsyncMirascope()


        async def main() -> None:
            await client.organization_invitations.list(
                organization_id="organizationId",
            )


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

    async def create(
        self,
        organization_id: str,
        *,
        recipient_email: str,
        role: OrganizationInvitationsCreateRequestRole,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> OrganizationInvitationsCreateResponse:
        """
        Parameters
        ----------
        organization_id : str

        recipient_email : str
            a string matching the pattern ^[^ \t\n\r\f\v@]+@[^ \t\n\r\f\v@]+[.][^ \t\n\r\f\v@]+$

        role : OrganizationInvitationsCreateRequestRole

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

        Returns
        -------
        OrganizationInvitationsCreateResponse
            Success

        Examples
        --------
        import asyncio

        from mirascope.api._generated import AsyncMirascope

        client = AsyncMirascope()


        async def main() -> None:
            await client.organization_invitations.create(
                organization_id="organizationId",
                recipient_email="recipientEmail",
                role="ADMIN",
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.create(
            organization_id,
            recipient_email=recipient_email,
            role=role,
            request_options=request_options,
        )
        return _response.data

    async def get(
        self,
        organization_id: str,
        invitation_id: str,
        *,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> OrganizationInvitationsGetResponse:
        """
        Parameters
        ----------
        organization_id : str

        invitation_id : str

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

        Returns
        -------
        OrganizationInvitationsGetResponse
            Success

        Examples
        --------
        import asyncio

        from mirascope.api._generated import AsyncMirascope

        client = AsyncMirascope()


        async def main() -> None:
            await client.organization_invitations.get(
                organization_id="organizationId",
                invitation_id="invitationId",
            )


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

    async def resend(
        self,
        organization_id: str,
        invitation_id: str,
        *,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> None:
        """
        Parameters
        ----------
        organization_id : str

        invitation_id : str

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

        Returns
        -------
        None

        Examples
        --------
        import asyncio

        from mirascope.api._generated import AsyncMirascope

        client = AsyncMirascope()


        async def main() -> None:
            await client.organization_invitations.resend(
                organization_id="organizationId",
                invitation_id="invitationId",
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.resend(
            organization_id, invitation_id, request_options=request_options
        )
        return _response.data

    async def revoke(
        self,
        organization_id: str,
        invitation_id: str,
        *,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> None:
        """
        Parameters
        ----------
        organization_id : str

        invitation_id : str

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

        Returns
        -------
        None

        Examples
        --------
        import asyncio

        from mirascope.api._generated import AsyncMirascope

        client = AsyncMirascope()


        async def main() -> None:
            await client.organization_invitations.revoke(
                organization_id="organizationId",
                invitation_id="invitationId",
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.revoke(
            organization_id, invitation_id, request_options=request_options
        )
        return _response.data

    async def accept(
        self, *, token: str, request_options: typing.Optional[RequestOptions] = None
    ) -> OrganizationInvitationsAcceptResponse:
        """
        Parameters
        ----------
        token : str

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

        Returns
        -------
        OrganizationInvitationsAcceptResponse
            Success

        Examples
        --------
        import asyncio

        from mirascope.api._generated import AsyncMirascope

        client = AsyncMirascope()


        async def main() -> None:
            await client.organization_invitations.accept(
                token="token",
            )


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