package com.wisp.app.ui.component

import androidx.compose.material3.AlertDialog
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.material3.TextButton
import androidx.compose.runtime.Composable

@Composable
fun AuthApprovalDialog(
    relayUrl: String,
    onAllow: () -> Unit,
    onDeny: () -> Unit
) {
    AlertDialog(
        onDismissRequest = onDeny,
        title = { Text("Relay Authentication") },
        text = {
            Text(
                text = "The relay $relayUrl is requesting authentication. " +
                    "Authenticating will reveal your identity (pubkey) to the relay operator, " +
                    "which some relays need before serving private DMs or chat rooms. " +
                    "If you allow once, we'll remember this choice for this relay.",
                style = MaterialTheme.typography.bodyMedium
            )
        },
        confirmButton = {
            TextButton(onClick = onAllow) {
                Text("Allow")
            }
        },
        dismissButton = {
            TextButton(onClick = onDeny) {
                Text("Deny")
            }
        }
    )
}
