'use client';
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { Shield, ShieldAlert, ShieldCheck, ShieldX } from 'lucide-react';
import { SettingsCard } from './components.js';
import { CheckIcon } from './securityPrimitives.js';
const LEVEL_STYLES = {
    secure: {
        pill: 'bg-success/15 text-success border-success/30',
        Icon: ShieldCheck,
        word: 'Secure',
    },
    needs_attention: {
        pill: 'bg-warning/15 text-warning border-warning/30',
        Icon: ShieldAlert,
        word: 'Needs attention',
    },
    at_risk: {
        pill: 'bg-destructive/15 text-destructive border-destructive/30',
        Icon: ShieldX,
        word: 'At risk',
    },
    unknown: { pill: 'bg-muted text-muted-foreground border-border', Icon: Shield, word: 'Unknown' },
};
const SEVERITY_STYLES = {
    critical: 'border-destructive/30 bg-destructive/10 text-destructive',
    warning: 'border-warning/30 bg-warning/10 text-warning',
    info: 'border-border bg-muted text-muted-foreground',
};
export function SecurityStatusCard({ status, onNavigate, }) {
    const style = LEVEL_STYLES[status.status];
    const { Icon } = style;
    return (_jsxs(SettingsCard, { title: "Security Status", description: status.description, actions: _jsxs("span", { className: `inline-flex items-center gap-1.5 rounded-full border px-2.5 py-1 text-sm font-medium ${style.pill}`, children: [_jsx(Icon, { size: 15, "aria-hidden": "true" }), style.word] }), children: [_jsx("div", { className: "grid grid-cols-1 gap-x-6 gap-y-1 sm:grid-cols-2", children: status.checks.map((check) => (_jsxs("button", { type: "button", disabled: !check.actionHref || !onNavigate, onClick: () => check.actionHref && onNavigate?.(check.actionHref), className: "enabled:hover:bg-accent/50 flex items-center justify-between gap-3 rounded-md py-1.5 text-left text-sm disabled:cursor-default", children: [_jsxs("span", { className: "flex items-center gap-2", children: [_jsx(CheckIcon, { status: check.status }), _jsx("span", { className: "text-foreground", children: check.label })] }), check.value !== undefined && (_jsx("span", { className: "text-muted-foreground text-right", children: check.value }))] }, check.key))) }), status.warnings.length > 0 && (_jsx("div", { className: "mt-4 space-y-2", "aria-live": "polite", children: status.warnings.map((w) => (_jsxs("div", { role: "note", className: `flex items-start justify-between gap-3 rounded-lg border p-3 text-sm ${SEVERITY_STYLES[w.severity]}`, children: [_jsxs("div", { children: [_jsx("p", { className: "font-medium", children: w.title }), _jsx("p", { className: "mt-0.5 opacity-90", children: w.description })] }), w.actionHref && w.actionLabel && onNavigate && (_jsx("button", { type: "button", onClick: () => onNavigate(w.actionHref), className: "shrink-0 self-center rounded-md border border-current/30 px-2.5 py-1 text-xs font-medium hover:opacity-80", children: w.actionLabel }))] }, w.id))) }))] }));
}
//# sourceMappingURL=SecurityStatusCard.js.map