# This file was auto-generated by Fern from our API Definition.

from __future__ import annotations

import typing

from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
from ...core.request_options import RequestOptions
from ...types.project_member import ProjectMember
from .raw_client import AsyncRawMembersClient, RawMembersClient

if typing.TYPE_CHECKING:
    from .bulk.client import AsyncBulkClient, BulkClient
    from .paginated.client import AsyncPaginatedClient, PaginatedClient
# this is used as the default value for optional parameters
OMIT = typing.cast(typing.Any, ...)


class MembersClient:
    def __init__(self, *, client_wrapper: SyncClientWrapper):
        self._raw_client = RawMembersClient(client_wrapper=client_wrapper)
        self._client_wrapper = client_wrapper
        self._bulk: typing.Optional[BulkClient] = None
        self._paginated: typing.Optional[PaginatedClient] = None

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

        Returns
        -------
        RawMembersClient
        """
        return self._raw_client

    def add(self, id: int, *, user: int, request_options: typing.Optional[RequestOptions] = None) -> ProjectMember:
        """
        <Card href="https://humansignal.com/goenterprise">
                <img style="pointer-events: none; margin-left: 0px; margin-right: 0px;" src="https://docs.humansignal.com/images/badge.svg" alt="Label Studio Enterprise badge"/>
                <p style="margin-top: 10px; font-size: 14px;">
                    This endpoint is not available in Label Studio Community Edition. [Learn more about Label Studio Enterprise](https://humansignal.com/goenterprise)
                </p>
            </Card>
        Add a member to a specific project.

        Parameters
        ----------
        id : int

        user : int

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

        Returns
        -------
        ProjectMember


        Examples
        --------
        from label_studio_sdk import LabelStudio

        client = LabelStudio(
            api_key="YOUR_API_KEY",
        )
        client.projects.members.add(
            id=1,
            user=1,
        )
        """
        _response = self._raw_client.add(id, user=user, request_options=request_options)
        return _response.data

    def remove(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> None:
        """
        <Card href="https://humansignal.com/goenterprise">
                <img style="pointer-events: none; margin-left: 0px; margin-right: 0px;" src="https://docs.humansignal.com/images/badge.svg" alt="Label Studio Enterprise badge"/>
                <p style="margin-top: 10px; font-size: 14px;">
                    This endpoint is not available in Label Studio Community Edition. [Learn more about Label Studio Enterprise](https://humansignal.com/goenterprise)
                </p>
            </Card>
        Remove a member from a specific project.

        Parameters
        ----------
        id : int

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

        Returns
        -------
        None

        Examples
        --------
        from label_studio_sdk import LabelStudio

        client = LabelStudio(
            api_key="YOUR_API_KEY",
        )
        client.projects.members.remove(
            id=1,
        )
        """
        _response = self._raw_client.remove(id, request_options=request_options)
        return _response.data

    @property
    def bulk(self):
        if self._bulk is None:
            from .bulk.client import BulkClient  # noqa: E402

            self._bulk = BulkClient(client_wrapper=self._client_wrapper)
        return self._bulk

    @property
    def paginated(self):
        if self._paginated is None:
            from .paginated.client import PaginatedClient  # noqa: E402

            self._paginated = PaginatedClient(client_wrapper=self._client_wrapper)
        return self._paginated


class AsyncMembersClient:
    def __init__(self, *, client_wrapper: AsyncClientWrapper):
        self._raw_client = AsyncRawMembersClient(client_wrapper=client_wrapper)
        self._client_wrapper = client_wrapper
        self._bulk: typing.Optional[AsyncBulkClient] = None
        self._paginated: typing.Optional[AsyncPaginatedClient] = None

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

        Returns
        -------
        AsyncRawMembersClient
        """
        return self._raw_client

    async def add(
        self, id: int, *, user: int, request_options: typing.Optional[RequestOptions] = None
    ) -> ProjectMember:
        """
        <Card href="https://humansignal.com/goenterprise">
                <img style="pointer-events: none; margin-left: 0px; margin-right: 0px;" src="https://docs.humansignal.com/images/badge.svg" alt="Label Studio Enterprise badge"/>
                <p style="margin-top: 10px; font-size: 14px;">
                    This endpoint is not available in Label Studio Community Edition. [Learn more about Label Studio Enterprise](https://humansignal.com/goenterprise)
                </p>
            </Card>
        Add a member to a specific project.

        Parameters
        ----------
        id : int

        user : int

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

        Returns
        -------
        ProjectMember


        Examples
        --------
        import asyncio

        from label_studio_sdk import AsyncLabelStudio

        client = AsyncLabelStudio(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.projects.members.add(
                id=1,
                user=1,
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.add(id, user=user, request_options=request_options)
        return _response.data

    async def remove(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> None:
        """
        <Card href="https://humansignal.com/goenterprise">
                <img style="pointer-events: none; margin-left: 0px; margin-right: 0px;" src="https://docs.humansignal.com/images/badge.svg" alt="Label Studio Enterprise badge"/>
                <p style="margin-top: 10px; font-size: 14px;">
                    This endpoint is not available in Label Studio Community Edition. [Learn more about Label Studio Enterprise](https://humansignal.com/goenterprise)
                </p>
            </Card>
        Remove a member from a specific project.

        Parameters
        ----------
        id : int

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

        Returns
        -------
        None

        Examples
        --------
        import asyncio

        from label_studio_sdk import AsyncLabelStudio

        client = AsyncLabelStudio(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.projects.members.remove(
                id=1,
            )


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

    @property
    def bulk(self):
        if self._bulk is None:
            from .bulk.client import AsyncBulkClient  # noqa: E402

            self._bulk = AsyncBulkClient(client_wrapper=self._client_wrapper)
        return self._bulk

    @property
    def paginated(self):
        if self._paginated is None:
            from .paginated.client import AsyncPaginatedClient  # noqa: E402

            self._paginated = AsyncPaginatedClient(client_wrapper=self._client_wrapper)
        return self._paginated
