/**
 * prompt-owner-team.ts — the interactive owner-team picker, shared by
 * `ailf init` and `ailf run`. Extracted from init.ts so the prompt UX is
 * defined once. See docs/design-docs/cli-interactive-input-resolution.md.
 */
import { KNOWN_OWNER_TEAMS, isKnownOwnerTeam, normalizeOwnerTeam, } from "../../_vendor/ailf-shared/index.js";
/**
 * Normalize a free-form team slug and warn (don't fail) when it is not a
 * known slug. Returns undefined for empty / "unknown" input.
 */
export function normalizeTeamSlug(raw) {
    const normalized = normalizeOwnerTeam(raw);
    if (normalized === "unknown")
        return undefined;
    if (!isKnownOwnerTeam(normalized)) {
        console.warn(`  ⚠ "${normalized}" is not a known team slug — using it anyway.`);
    }
    return normalized;
}
/**
 * Prompt for the owner team. Returns the normalized slug, or undefined when
 * the user skips. Same choice list `ailf init` has always shown.
 */
export async function promptOwnerTeam() {
    const { select, input } = await import("@inquirer/prompts");
    const OTHER = "__other__";
    const SKIP = "__skip__";
    const choice = await select({
        message: "Which team owns these evaluations?",
        choices: [
            ...KNOWN_OWNER_TEAMS.map((t) => ({ name: t, value: t })),
            { name: "Other (enter manually)", value: OTHER },
            { name: "Skip — no team", value: SKIP },
        ],
    });
    if (choice === SKIP)
        return undefined;
    if (choice === OTHER) {
        const raw = await input({ message: "Team slug:" });
        return normalizeTeamSlug(raw);
    }
    return choice;
}
