use ratatui::prelude::*;
use crate::tui::app::App;
use crate::tui::widgets::card::{self, selectable_row, Card};
pub fn render(frame: &mut Frame, app: &App, area: Rect) {
let cursor = app.wizard.as_ref().map(|w| w.method_cursor).unwrap_or(0);
let mut body: Vec<Line> = Vec::new();
body.extend(selectable_row(
"1",
"Browser · Auth0 · recommended",
"Opens your default browser and signs in via SSO / email / Google.",
cursor == 0,
));
body.push(Line::from(""));
body.extend(selectable_row(
"2",
"API key",
"Paste a key from Zilliz Cloud → Settings → API Keys.",
cursor == 1,
));
let footer = Line::from(vec![Span::styled(
"The browser flow stores a refresh token in ~/.zilliz/credentials (chmod 600).",
Style::default().fg(Color::DarkGray),
)]);
card::render(
frame,
area,
&Card {
eyebrow: Some("SIGN IN · STEP 2 OF 3"),
title: Some("How would you like to authenticate?"),
body,
footer: Some(footer),
error: app.wizard.as_ref().and_then(|w| w.error.as_deref()),
step: Some("2 / 3"),
max_width: 80,
},
);
}