# 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 AsyncRawProjectMembershipsClient, RawProjectMembershipsClient
from .types.project_memberships_create_request_role import (
    ProjectMembershipsCreateRequestRole,
)
from .types.project_memberships_create_response import ProjectMembershipsCreateResponse
from .types.project_memberships_get_response import ProjectMembershipsGetResponse
from .types.project_memberships_list_response_item import (
    ProjectMembershipsListResponseItem,
)
from .types.project_memberships_update_request_role import (
    ProjectMembershipsUpdateRequestRole,
)
from .types.project_memberships_update_response import ProjectMembershipsUpdateResponse

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


class ProjectMembershipsClient:
    def __init__(self, *, client_wrapper: SyncClientWrapper):
        self._raw_client = RawProjectMembershipsClient(client_wrapper=client_wrapper)

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

        Returns
        -------
        RawProjectMembershipsClient
        """
        return self._raw_client

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

        project_id : str

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

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

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

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

    def create(
        self,
        organization_id: str,
        project_id: str,
        *,
        member_id: str,
        role: ProjectMembershipsCreateRequestRole,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> ProjectMembershipsCreateResponse:
        """
        Parameters
        ----------
        organization_id : str

        project_id : str

        member_id : str

        role : ProjectMembershipsCreateRequestRole

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

        Returns
        -------
        ProjectMembershipsCreateResponse
            Success

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

        client = Mirascope()
        client.project_memberships.create(
            organization_id="organizationId",
            project_id="projectId",
            member_id="memberId",
            role="ADMIN",
        )
        """
        _response = self._raw_client.create(
            organization_id,
            project_id,
            member_id=member_id,
            role=role,
            request_options=request_options,
        )
        return _response.data

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

        project_id : str

        member_id : str

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

        Returns
        -------
        ProjectMembershipsGetResponse
            Success

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

        client = Mirascope()
        client.project_memberships.get(
            organization_id="organizationId",
            project_id="projectId",
            member_id="memberId",
        )
        """
        _response = self._raw_client.get(
            organization_id, project_id, member_id, request_options=request_options
        )
        return _response.data

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

        project_id : str

        member_id : str

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

        Returns
        -------
        None

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

        client = Mirascope()
        client.project_memberships.delete(
            organization_id="organizationId",
            project_id="projectId",
            member_id="memberId",
        )
        """
        _response = self._raw_client.delete(
            organization_id, project_id, member_id, request_options=request_options
        )
        return _response.data

    def update(
        self,
        organization_id: str,
        project_id: str,
        member_id: str,
        *,
        role: ProjectMembershipsUpdateRequestRole,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> ProjectMembershipsUpdateResponse:
        """
        Parameters
        ----------
        organization_id : str

        project_id : str

        member_id : str

        role : ProjectMembershipsUpdateRequestRole

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

        Returns
        -------
        ProjectMembershipsUpdateResponse
            Success

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

        client = Mirascope()
        client.project_memberships.update(
            organization_id="organizationId",
            project_id="projectId",
            member_id="memberId",
            role="ADMIN",
        )
        """
        _response = self._raw_client.update(
            organization_id,
            project_id,
            member_id,
            role=role,
            request_options=request_options,
        )
        return _response.data


class AsyncProjectMembershipsClient:
    def __init__(self, *, client_wrapper: AsyncClientWrapper):
        self._raw_client = AsyncRawProjectMembershipsClient(
            client_wrapper=client_wrapper
        )

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

        Returns
        -------
        AsyncRawProjectMembershipsClient
        """
        return self._raw_client

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

        project_id : str

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

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

        Examples
        --------
        import asyncio

        from mirascope.api._generated import AsyncMirascope

        client = AsyncMirascope()


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


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

    async def create(
        self,
        organization_id: str,
        project_id: str,
        *,
        member_id: str,
        role: ProjectMembershipsCreateRequestRole,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> ProjectMembershipsCreateResponse:
        """
        Parameters
        ----------
        organization_id : str

        project_id : str

        member_id : str

        role : ProjectMembershipsCreateRequestRole

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

        Returns
        -------
        ProjectMembershipsCreateResponse
            Success

        Examples
        --------
        import asyncio

        from mirascope.api._generated import AsyncMirascope

        client = AsyncMirascope()


        async def main() -> None:
            await client.project_memberships.create(
                organization_id="organizationId",
                project_id="projectId",
                member_id="memberId",
                role="ADMIN",
            )


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

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

        project_id : str

        member_id : str

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

        Returns
        -------
        ProjectMembershipsGetResponse
            Success

        Examples
        --------
        import asyncio

        from mirascope.api._generated import AsyncMirascope

        client = AsyncMirascope()


        async def main() -> None:
            await client.project_memberships.get(
                organization_id="organizationId",
                project_id="projectId",
                member_id="memberId",
            )


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

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

        project_id : str

        member_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.project_memberships.delete(
                organization_id="organizationId",
                project_id="projectId",
                member_id="memberId",
            )


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

    async def update(
        self,
        organization_id: str,
        project_id: str,
        member_id: str,
        *,
        role: ProjectMembershipsUpdateRequestRole,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> ProjectMembershipsUpdateResponse:
        """
        Parameters
        ----------
        organization_id : str

        project_id : str

        member_id : str

        role : ProjectMembershipsUpdateRequestRole

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

        Returns
        -------
        ProjectMembershipsUpdateResponse
            Success

        Examples
        --------
        import asyncio

        from mirascope.api._generated import AsyncMirascope

        client = AsyncMirascope()


        async def main() -> None:
            await client.project_memberships.update(
                organization_id="organizationId",
                project_id="projectId",
                member_id="memberId",
                role="ADMIN",
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.update(
            organization_id,
            project_id,
            member_id,
            role=role,
            request_options=request_options,
        )
        return _response.data
