/* ═══════════════════════════════════════════════════════════════════
   SecData.jsx — sample data for the Customer Security surface. v1.0.0
   Ported verbatim from the Claude Design v2 package
   (_CLAUDE-DESIGN/_2026-06-12-v2-SaaS-Redesign/security-data.jsx).
   SAFETY: this page DESCRIBES posture — it never shows secrets, keys,
   or token values. Connections are abstract ("signed SSO/JWT
   handshake"), never a string. IPs are documentation ranges. Sample
   data only — the surface runs on this dataset until the customer
   security API lands; the SA-only launch gate covers that window.
   Load order: FIRST of the four Sec modules (data → charts → page →
   surface — matches the design package's index.html order).
   Registers: window.WPSB.SecData = { SEC_SIGNAL, SEC_POSTURE,
   SEC_SESSIONS, SEC_SITES, SEC_CELL, SEC_AUDIT }.
   ═══════════════════════════════════════════════════════════════════ */
(function () {

/* security signal meta — own axis (not gating, not workflow). Shape+label+color. */
const SEC_SIGNAL = {
  protected: { c: 'var(--v-good)', cf: 'var(--v-good-fill)', icon: 'check-circle',  label: 'Protected' },
  review:    { c: 'var(--v-warn)', cf: 'var(--v-warn-fill)', icon: 'alert-triangle', label: 'Review' },
  atrisk:    { c: 'var(--v-poor)', cf: 'var(--v-poor-fill)', icon: 'x-circle',       label: 'Action needed' },
  off:       { c: 'var(--muted)',  cf: 'var(--muted)',       icon: 'lock',           label: 'Off' },
};

/* posture stat row */
const SEC_POSTURE = [
  { key: '2fa',   icon: 'smartphone', label: 'Workspace 2FA', value: 'Enforced', signal: 'protected' },
  { key: 'sess',  icon: 'user',       label: 'Active sessions', value: '3', signal: 'protected' },
  { key: 'sso',   icon: 'key',        label: 'Single sign-on', value: 'Off', signal: 'off', gate: 'Enterprise' },
  { key: 'sites', icon: 'globe',      label: 'Sites protected', value: '5 / 6', signal: 'review' },
];

/* active sessions (masked — no tokens). `current` = this device. */
const SEC_SESSIONS = [
  { device: 'MacBook Pro', agent: 'Chrome · macOS', loc: 'San Francisco, US', last: 'Active now', current: true },
  { device: 'iPhone 15', agent: 'Safari · iOS', loc: 'San Francisco, US', last: '2 hours ago', current: false },
  { device: 'Windows PC', agent: 'Edge · Windows', loc: 'Austin, US', last: '3 days ago', current: false, flag: true },
];

/* connected-site security signals — per-site table. Each cell reads by icon+label. */
const SEC_SITES = [
  { site: 'maplewood.co',     conn: 'ok',    twofa: 'ok',  ssl: 'ok',   scan: 'ok',   status: 'protected' },
  { site: 'harbor.co',        conn: 'ok',    twofa: 'ok',  ssl: 'ok',   scan: 'warn', status: 'review' },
  { site: 'bloomhaus.com',    conn: 'ok',    twofa: 'ok',  ssl: 'ok',   scan: 'ok',   status: 'protected' },
  { site: 'atlasfreight.com', conn: 'stale', twofa: 'ok',  ssl: 'ok',   scan: 'ok',   status: 'review' },
  { site: 'lumen.co',         conn: 'ok',    twofa: 'ok',  ssl: 'ok',   scan: 'ok',   status: 'protected' },
  { site: 'northwind.studio', conn: 'off',   twofa: 'off', ssl: 'warn', scan: 'off',  status: 'atrisk' },
];
/* cell meta for the per-site signals (icon + short label + signal key) */
const SEC_CELL = {
  ok:    { signal: 'protected', label: 'OK' },
  warn:  { signal: 'review',    label: 'Check' },
  stale: { signal: 'review',    label: 'Stale' },
  off:   { signal: 'atrisk',    label: 'Offline' },
};

/* audit log — time / who / action / subject / IP. IPs are documentation ranges. */
const SEC_AUDIT = [
  { t: '14:31', who: 'Jordan O.', action: 'Enabled 2FA enforcement', subject: 'Workspace', ip: '192.0.2.14' },
  { t: '13:58', who: 'Priya R.',  action: 'Revoked a session',        subject: 'Edge · Windows', ip: '198.51.100.7' },
  { t: 'Jun 9', who: 'Jordan O.', action: 'Connected a site',         subject: 'bloomhaus.com', ip: '192.0.2.14' },
  { t: 'Jun 9', who: 'System',    action: 'Rotated SSO handshake',     subject: 'maplewood.co', ip: '—' },
  { t: 'Jun 8', who: 'Dev (CI)',  action: 'Updated IP allowlist',     subject: 'Workspace', ip: '203.0.113.9' },
  { t: 'Jun 7', who: 'Jordan O.', action: 'Changed session timeout',  subject: '8 hours', ip: '192.0.2.14' },
];

window.WPSB = window.WPSB || {};
window.WPSB.SecData = { SEC_SIGNAL, SEC_POSTURE, SEC_SESSIONS, SEC_SITES, SEC_CELL, SEC_AUDIT };
console.log('[WPSB] SecData v1.0.0 loaded (sample dataset; no secrets rendered)');
})();
