# 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 ..types.get_config_response import GetConfigResponse
from .raw_client import AsyncRawConfigsClient, RawConfigsClient


class ConfigsClient:
    def __init__(self, *, client_wrapper: SyncClientWrapper):
        self._raw_client = RawConfigsClient(client_wrapper=client_wrapper)

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

        Returns
        -------
        RawConfigsClient
        """
        return self._raw_client

    def get_config(
        self,
        *,
        base_id: str,
        config_name: typing.Optional[str] = None,
        environment_name: typing.Optional[str] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> GetConfigResponse:
        """
        Parameters
        ----------
        base_id : str

        config_name : typing.Optional[str]

        environment_name : typing.Optional[str]

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

        Returns
        -------
        GetConfigResponse
            Successful Response

        Examples
        --------
        from agenta import AgentaApi

        client = AgentaApi(
            api_key="YOUR_API_KEY",
        )
        client.configs.get_config(
            base_id="base_id",
        )
        """
        _response = self._raw_client.get_config(
            base_id=base_id,
            config_name=config_name,
            environment_name=environment_name,
            request_options=request_options,
        )
        return _response.data

    def get_config_deployment_revision(
        self,
        deployment_revision_id: str,
        *,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> typing.Optional[typing.Any]:
        """
        Parameters
        ----------
        deployment_revision_id : str

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

        Returns
        -------
        typing.Optional[typing.Any]
            Successful Response

        Examples
        --------
        from agenta import AgentaApi

        client = AgentaApi(
            api_key="YOUR_API_KEY",
        )
        client.configs.get_config_deployment_revision(
            deployment_revision_id="deployment_revision_id",
        )
        """
        _response = self._raw_client.get_config_deployment_revision(
            deployment_revision_id, request_options=request_options
        )
        return _response.data

    def revert_deployment_revision(
        self,
        deployment_revision_id: str,
        *,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> typing.Optional[typing.Any]:
        """
        Parameters
        ----------
        deployment_revision_id : str

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

        Returns
        -------
        typing.Optional[typing.Any]
            Successful Response

        Examples
        --------
        from agenta import AgentaApi

        client = AgentaApi(
            api_key="YOUR_API_KEY",
        )
        client.configs.revert_deployment_revision(
            deployment_revision_id="deployment_revision_id",
        )
        """
        _response = self._raw_client.revert_deployment_revision(
            deployment_revision_id, request_options=request_options
        )
        return _response.data


class AsyncConfigsClient:
    def __init__(self, *, client_wrapper: AsyncClientWrapper):
        self._raw_client = AsyncRawConfigsClient(client_wrapper=client_wrapper)

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

        Returns
        -------
        AsyncRawConfigsClient
        """
        return self._raw_client

    async def get_config(
        self,
        *,
        base_id: str,
        config_name: typing.Optional[str] = None,
        environment_name: typing.Optional[str] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> GetConfigResponse:
        """
        Parameters
        ----------
        base_id : str

        config_name : typing.Optional[str]

        environment_name : typing.Optional[str]

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

        Returns
        -------
        GetConfigResponse
            Successful Response

        Examples
        --------
        import asyncio

        from agenta import AsyncAgentaApi

        client = AsyncAgentaApi(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.configs.get_config(
                base_id="base_id",
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.get_config(
            base_id=base_id,
            config_name=config_name,
            environment_name=environment_name,
            request_options=request_options,
        )
        return _response.data

    async def get_config_deployment_revision(
        self,
        deployment_revision_id: str,
        *,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> typing.Optional[typing.Any]:
        """
        Parameters
        ----------
        deployment_revision_id : str

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

        Returns
        -------
        typing.Optional[typing.Any]
            Successful Response

        Examples
        --------
        import asyncio

        from agenta import AsyncAgentaApi

        client = AsyncAgentaApi(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.configs.get_config_deployment_revision(
                deployment_revision_id="deployment_revision_id",
            )


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

    async def revert_deployment_revision(
        self,
        deployment_revision_id: str,
        *,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> typing.Optional[typing.Any]:
        """
        Parameters
        ----------
        deployment_revision_id : str

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

        Returns
        -------
        typing.Optional[typing.Any]
            Successful Response

        Examples
        --------
        import asyncio

        from agenta import AsyncAgentaApi

        client = AsyncAgentaApi(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.configs.revert_deployment_revision(
                deployment_revision_id="deployment_revision_id",
            )


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