/**
 * Convert an onboarding status code into display copy.
 *
 * @param {string} value - Raw status returned by the backend.
 * @returns {string} Human-readable status label.
 */
export function statusLabel(value) {
    const key = (value || "").trim();
    if (key === "pending_email_verification") return "confirm email";
    if (key === "pending") return "awaiting approval";
    if (key === "accounts_building") return "accounts building";
    if (key === "awaiting_onboarding") return "awaiting onboarding";
    if (key === "ready") return "ready";
    if (key === "denied") return "rejected";
    return key || "unknown";
}

/**
 * Convert an onboarding status code into the matching pill class.
 *
 * @param {string} value - Raw status returned by the backend.
 * @returns {string} CSS class for status emphasis.
 */
export function statusPillClass(value) {
    const key = (value || "").trim();
    if (key === "pending_email_verification") return "pill-warn";
    if (key === "pending") return "pill-wait";
    if (key === "accounts_building") return "pill-warn";
    if (key === "awaiting_onboarding") return "pill-ok";
    if (key === "ready") return "pill-info";
    if (key === "denied") return "pill-bad";
    return "pill-warn";
}

/**
 * Convert a provisioning task status into a pill class.
 *
 * @param {string} value - Raw task status returned by the backend.
 * @returns {string} CSS class for task emphasis.
 */
export function taskPillClass(value) {
    const key = (value || "").trim();
    if (key === "ok") return "pill-ok";
    if (key === "error") return "pill-bad";
    return "pill-warn";
}
