package dev.ulfrx.recipe.auth

import dev.lokksmith.client.request.flow.AuthFlow
import dev.lokksmith.client.request.flow.AuthFlowResultProvider

/**
 * Bridges suspending OIDC orchestration ([OidcClient]) to Lokksmith's
 * Compose-native launcher.
 *
 * Lokksmith owns the platform user-agent step (Custom Tabs / `ASWebAuthenticationSession`)
 * via `rememberAuthFlowLauncher()`, which exposes its state as Compose `State`. To keep
 * [AuthSession] / [LoginViewModel] callable as plain `suspend` functions, the screen
 * wraps the Compose launcher in an [AuthBrowser] (see [ComposeAuthBrowser]) and hands
 * it to the ViewModel. Result polling happens via `snapshotFlow`.
 *
 * Tests can fake this seam without touching Compose or Lokksmith.
 */
interface AuthBrowser {
    suspend fun launchAndAwait(initiation: AuthFlow.Initiation): AuthFlowResultProvider.Result
}
