# 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 AsyncRawEnvironmentsClient, RawEnvironmentsClient
from .types.environments_create_response import EnvironmentsCreateResponse
from .types.environments_get_response import EnvironmentsGetResponse
from .types.environments_list_response_item import EnvironmentsListResponseItem
from .types.environments_update_response import EnvironmentsUpdateResponse

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


class EnvironmentsClient:
    def __init__(self, *, client_wrapper: SyncClientWrapper):
        self._raw_client = RawEnvironmentsClient(client_wrapper=client_wrapper)

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

        Returns
        -------
        RawEnvironmentsClient
        """
        return self._raw_client

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

        project_id : str

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

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

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

        client = Mirascope()
        client.environments.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,
        *,
        name: str,
        slug: str,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> EnvironmentsCreateResponse:
        """
        Parameters
        ----------
        organization_id : str

        project_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
        -------
        EnvironmentsCreateResponse
            Success

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

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

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

        project_id : str

        environment_id : str

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

        Returns
        -------
        EnvironmentsGetResponse
            Success

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

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

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

        project_id : str

        environment_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
        -------
        EnvironmentsUpdateResponse
            Success

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

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

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

        project_id : str

        environment_id : str

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

        Returns
        -------
        None

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

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


class AsyncEnvironmentsClient:
    def __init__(self, *, client_wrapper: AsyncClientWrapper):
        self._raw_client = AsyncRawEnvironmentsClient(client_wrapper=client_wrapper)

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

        Returns
        -------
        AsyncRawEnvironmentsClient
        """
        return self._raw_client

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

        project_id : str

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

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

        Examples
        --------
        import asyncio

        from mirascope.api._generated import AsyncMirascope

        client = AsyncMirascope()


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

        project_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
        -------
        EnvironmentsCreateResponse
            Success

        Examples
        --------
        import asyncio

        from mirascope.api._generated import AsyncMirascope

        client = AsyncMirascope()


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


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

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

        project_id : str

        environment_id : str

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

        Returns
        -------
        EnvironmentsGetResponse
            Success

        Examples
        --------
        import asyncio

        from mirascope.api._generated import AsyncMirascope

        client = AsyncMirascope()


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


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

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

        project_id : str

        environment_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
        -------
        EnvironmentsUpdateResponse
            Success

        Examples
        --------
        import asyncio

        from mirascope.api._generated import AsyncMirascope

        client = AsyncMirascope()


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


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

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

        project_id : str

        environment_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.environments.delete(
                organization_id="organizationId",
                project_id="projectId",
                environment_id="environmentId",
            )


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