# 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 AsyncRawAuthClient, RawAuthClient
from .types.session_token_response import SessionTokenResponse

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


class AuthClient:
    def __init__(self, *, client_wrapper: SyncClientWrapper):
        self._raw_client = RawAuthClient(client_wrapper=client_wrapper)

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

        Returns
        -------
        RawAuthClient
        """
        return self._raw_client

    def session_token(
        self, *, ttl_seconds: int, request_options: typing.Optional[RequestOptions] = None
    ) -> SessionTokenResponse:
        """
        Creates a short-lived session token that can be used to authenticate
        WebSocket connections. Session tokens are useful for client-side applications where
        you don’t want to expose your API key.

        Parameters
        ----------
        ttl_seconds : int

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

        Returns
        -------
        SessionTokenResponse

        Examples
        --------
        from mavenagi import MavenAGI

        client = MavenAGI(
            organization_id="YOUR_ORGANIZATION_ID",
            agent_id="YOUR_AGENT_ID",
            app_id="YOUR_APP_ID",
            app_secret="YOUR_APP_SECRET",
        )
        client.auth.session_token(
            ttl_seconds=3600,
        )
        """
        _response = self._raw_client.session_token(ttl_seconds=ttl_seconds, request_options=request_options)
        return _response.data


class AsyncAuthClient:
    def __init__(self, *, client_wrapper: AsyncClientWrapper):
        self._raw_client = AsyncRawAuthClient(client_wrapper=client_wrapper)

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

        Returns
        -------
        AsyncRawAuthClient
        """
        return self._raw_client

    async def session_token(
        self, *, ttl_seconds: int, request_options: typing.Optional[RequestOptions] = None
    ) -> SessionTokenResponse:
        """
        Creates a short-lived session token that can be used to authenticate
        WebSocket connections. Session tokens are useful for client-side applications where
        you don’t want to expose your API key.

        Parameters
        ----------
        ttl_seconds : int

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

        Returns
        -------
        SessionTokenResponse

        Examples
        --------
        import asyncio

        from mavenagi import AsyncMavenAGI

        client = AsyncMavenAGI(
            organization_id="YOUR_ORGANIZATION_ID",
            agent_id="YOUR_AGENT_ID",
            app_id="YOUR_APP_ID",
            app_secret="YOUR_APP_SECRET",
        )


        async def main() -> None:
            await client.auth.session_token(
                ttl_seconds=3600,
            )


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