# 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 AsyncRawAuthenticationClient, RawAuthenticationClient
from .types.authorize_response import AuthorizeResponse


class AuthenticationClient:
    def __init__(self, *, client_wrapper: SyncClientWrapper):
        self._raw_client = RawAuthenticationClient(client_wrapper=client_wrapper)

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

        Returns
        -------
        RawAuthenticationClient
        """
        return self._raw_client

    def authorize(self, *, request_options: typing.Optional[RequestOptions] = None) -> AuthorizeResponse:
        """
        Get the authenticated principal based on the provided token.

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

        Returns
        -------
        AuthorizeResponse
            The scopes of the provided token.

        Examples
        --------
        from planqk import PlanqkApi

        client = PlanqkApi(
            organization_id="YOUR_ORGANIZATION_ID",
            api_key="YOUR_API_KEY",
        )
        client.authentication.authorize()
        """
        _response = self._raw_client.authorize(request_options=request_options)
        return _response.data


class AsyncAuthenticationClient:
    def __init__(self, *, client_wrapper: AsyncClientWrapper):
        self._raw_client = AsyncRawAuthenticationClient(client_wrapper=client_wrapper)

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

        Returns
        -------
        AsyncRawAuthenticationClient
        """
        return self._raw_client

    async def authorize(self, *, request_options: typing.Optional[RequestOptions] = None) -> AuthorizeResponse:
        """
        Get the authenticated principal based on the provided token.

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

        Returns
        -------
        AuthorizeResponse
            The scopes of the provided token.

        Examples
        --------
        import asyncio

        from planqk import AsyncPlanqkApi

        client = AsyncPlanqkApi(
            organization_id="YOUR_ORGANIZATION_ID",
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.authentication.authorize()


        asyncio.run(main())
        """
        _response = await self._raw_client.authorize(request_options=request_options)
        return _response.data
