# 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 AsyncRawProjectsClient, RawProjectsClient
from .types.projects_create_response import ProjectsCreateResponse
from .types.projects_get_response import ProjectsGetResponse
from .types.projects_list_response_item import ProjectsListResponseItem
from .types.projects_update_response import ProjectsUpdateResponse

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


class ProjectsClient:
    def __init__(self, *, client_wrapper: SyncClientWrapper):
        self._raw_client = RawProjectsClient(client_wrapper=client_wrapper)

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

        Returns
        -------
        RawProjectsClient
        """
        return self._raw_client

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

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

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

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

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

    def create(
        self, organization_id: str, *, name: str, slug: str, request_options: typing.Optional[RequestOptions] = None
    ) -> ProjectsCreateResponse:
        """
        Parameters
        ----------
        organization_id : str

        name : str
            a string at most 100 character(s) long

        slug : str
            a string matching the pattern ^[a-z0-9][a-z0-9_-]*[a-z0-9]$

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

        Returns
        -------
        ProjectsCreateResponse
            Success

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

        client = Mirascope()
        client.projects.create(
            organization_id="organizationId",
            name="name",
            slug="slug",
        )
        """
        _response = self._raw_client.create(organization_id, name=name, slug=slug, request_options=request_options)
        return _response.data

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

        project_id : str

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

        Returns
        -------
        ProjectsGetResponse
            Success

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

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

    def update(
        self,
        organization_id: str,
        project_id: str,
        *,
        name: typing.Optional[str] = OMIT,
        slug: typing.Optional[str] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> ProjectsUpdateResponse:
        """
        Parameters
        ----------
        organization_id : str

        project_id : str

        name : typing.Optional[str]
            a string at most 100 character(s) long

        slug : typing.Optional[str]
            a string matching the pattern ^[a-z0-9][a-z0-9_-]*[a-z0-9]$

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

        Returns
        -------
        ProjectsUpdateResponse
            Success

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

        client = Mirascope()
        client.projects.update(
            organization_id="organizationId",
            project_id="projectId",
        )
        """
        _response = self._raw_client.update(
            organization_id, project_id, name=name, slug=slug, request_options=request_options
        )
        return _response.data

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

        project_id : str

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

        Returns
        -------
        None

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

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


class AsyncProjectsClient:
    def __init__(self, *, client_wrapper: AsyncClientWrapper):
        self._raw_client = AsyncRawProjectsClient(client_wrapper=client_wrapper)

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

        Returns
        -------
        AsyncRawProjectsClient
        """
        return self._raw_client

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

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

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

        Examples
        --------
        import asyncio

        from mirascope.api._generated import AsyncMirascope

        client = AsyncMirascope()


        async def main() -> None:
            await client.projects.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, *, name: str, slug: str, request_options: typing.Optional[RequestOptions] = None
    ) -> ProjectsCreateResponse:
        """
        Parameters
        ----------
        organization_id : str

        name : str
            a string at most 100 character(s) long

        slug : str
            a string matching the pattern ^[a-z0-9][a-z0-9_-]*[a-z0-9]$

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

        Returns
        -------
        ProjectsCreateResponse
            Success

        Examples
        --------
        import asyncio

        from mirascope.api._generated import AsyncMirascope

        client = AsyncMirascope()


        async def main() -> None:
            await client.projects.create(
                organization_id="organizationId",
                name="name",
                slug="slug",
            )


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

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

        project_id : str

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

        Returns
        -------
        ProjectsGetResponse
            Success

        Examples
        --------
        import asyncio

        from mirascope.api._generated import AsyncMirascope

        client = AsyncMirascope()


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


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

    async def update(
        self,
        organization_id: str,
        project_id: str,
        *,
        name: typing.Optional[str] = OMIT,
        slug: typing.Optional[str] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> ProjectsUpdateResponse:
        """
        Parameters
        ----------
        organization_id : str

        project_id : str

        name : typing.Optional[str]
            a string at most 100 character(s) long

        slug : typing.Optional[str]
            a string matching the pattern ^[a-z0-9][a-z0-9_-]*[a-z0-9]$

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

        Returns
        -------
        ProjectsUpdateResponse
            Success

        Examples
        --------
        import asyncio

        from mirascope.api._generated import AsyncMirascope

        client = AsyncMirascope()


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


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

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

        project_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.projects.delete(
                organization_id="organizationId",
                project_id="projectId",
            )


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