// DataLoop Cabinet — synthetic data for dashboard, logs, keys, invoices
const CAB = {
  user: {
    name: "Артём Воронцов",
    email: "a.vorontsov@npd.io",
    org: "ООО «Новый поиск данных»",
    role: "Владелец",
    initials: "АВ",
  },
  account: {
    plan: "Прод",
    planPrice: "9 800",
    planRenews: "12 июня 2026",
    quotaDaily: 500000,
    quotaUsedToday: 312408,
  },
  // 14 days of usage; last is "today" (partial)
  usage14: [
    284100, 312400, 298700, 305200, 341800, 358900, 290400,
    324100, 367200, 388600, 401500, 442100, 458300, 312408,
  ],
  errors14: [
    420, 510, 380, 290, 880, 612, 305,
    288, 412, 376, 510, 488, 442, 198,
  ],
  // Sparkline data per stat tile
  sparks: {
    requests: [12, 18, 22, 19, 28, 30, 27, 32, 36, 38, 42, 40, 47, 44],
    latency: [29, 28, 30, 31, 28, 27, 29, 28, 28, 27, 28, 29, 28, 27],
    errors:  [4, 6, 3, 2, 9, 6, 3, 3, 4, 4, 5, 5, 4, 2],
    uptime:  [99.99, 99.99, 99.98, 99.99, 99.99, 99.99, 99.99, 99.99, 99.99, 99.99, 99.99, 99.99, 99.99, 99.99],
  },
  // API keys
  keys: [
    {
      id: "k1",
      name: "Production · backend",
      prefix: "sk_live_a1b2",
      tail: "····8c4f",
      created: "12 дн. назад",
      lastUsed: "2 мин назад",
      scope: "full",
      env: "live",
      requests7d: "2.8 М",
    },
    {
      id: "k2",
      name: "Mobile app · iOS",
      prefix: "sk_live_qm9z",
      tail: "····d201",
      created: "47 дн. назад",
      lastUsed: "14 мин назад",
      scope: "suggest",
      env: "live",
      requests7d: "1.4 М",
    },
    {
      id: "k3",
      name: "Тест Артёма",
      prefix: "sk_test_x9y8",
      tail: "····4ff0",
      created: "2 ч назад",
      lastUsed: "3 ч назад",
      scope: "full",
      env: "test",
      requests7d: "412",
    },
    {
      id: "k4",
      name: "Старый ключ",
      prefix: "sk_live_qr3s",
      tail: "····0011",
      created: "2 мес назад",
      lastUsed: "никогда",
      scope: "readonly",
      env: "live",
      requests7d: "0",
    },
  ],
  // Live-feed log entries
  logs: [
    { t: "13:42:08", m: "POST", p: "/v1/suggest/address", s: 200, ms: 14, ip: "85.21.84.12", key: "sk_live_a1b2", body: "{\"query\":\"тверская 12\"}", req: "req_2v6m4u8" },
    { t: "13:42:07", m: "POST", p: "/v1/suggest/address", s: 200, ms: 11, ip: "85.21.84.12", key: "sk_live_a1b2", body: "{\"query\":\"тверская\"}", req: "req_2v6m4u7" },
    { t: "13:42:06", m: "POST", p: "/v1/geocode/forward", s: 200, ms: 22, ip: "188.42.16.7", key: "sk_live_qm9z", body: "{\"address\":\"Невский 28\"}", req: "req_2v6m4u6" },
    { t: "13:42:05", m: "POST", p: "/v1/suggest/address", s: 200, ms: 13, ip: "85.21.84.12", key: "sk_live_a1b2", body: "{\"query\":\"твер\"}", req: "req_2v6m4u5" },
    { t: "13:42:03", m: "POST", p: "/v1/parse", s: 422, ms: 9,  ip: "37.110.22.18", key: "sk_live_a1b2", body: "{\"address\":\"!!!\"}", req: "req_2v6m4u3" },
    { t: "13:42:01", m: "POST", p: "/v1/geocode/reverse", s: 200, ms: 18, ip: "188.42.16.7", key: "sk_live_qm9z", body: "{\"lat\":55.76,\"lon\":37.61}", req: "req_2v6m4u1" },
    { t: "13:41:59", m: "POST", p: "/v1/batch", s: 200, ms: 412, ip: "85.21.84.12", key: "sk_live_a1b2", body: "{\"items\":[...50000]}", req: "req_2v6m4tz" },
    { t: "13:41:58", m: "POST", p: "/v1/suggest/address", s: 429, ms: 4,  ip: "37.110.22.18", key: "sk_test_x9y8", body: "{\"query\":\"м\"}", req: "req_2v6m4ty" },
    { t: "13:41:55", m: "POST", p: "/v1/suggest/address", s: 200, ms: 12, ip: "85.21.84.12", key: "sk_live_a1b2", body: "{\"query\":\"кутузовский 35\"}", req: "req_2v6m4tv" },
    { t: "13:41:54", m: "POST", p: "/v1/tree", s: 200, ms: 28, ip: "188.42.16.7", key: "sk_live_qm9z", body: "{\"fias\":\"8da95206-...\"}", req: "req_2v6m4tu" },
    { t: "13:41:51", m: "POST", p: "/v1/suggest/address", s: 200, ms: 11, ip: "85.21.84.12", key: "sk_live_a1b2", body: "{\"query\":\"красный проспект\"}", req: "req_2v6m4tr" },
    { t: "13:41:48", m: "POST", p: "/v1/parse", s: 200, ms: 8,  ip: "188.42.16.7", key: "sk_live_qm9z", body: "{\"address\":\"СПб Невский 28\"}", req: "req_2v6m4to" },
    { t: "13:41:47", m: "POST", p: "/v1/suggest/address", s: 200, ms: 15, ip: "85.21.84.12", key: "sk_live_a1b2", body: "{\"query\":\"казань баумана\"}", req: "req_2v6m4tn" },
    { t: "13:41:44", m: "POST", p: "/v1/suggest/address", s: 500, ms: 184, ip: "85.21.84.12", key: "sk_live_a1b2", body: "{\"query\":\"...\"}", req: "req_2v6m4tk" },
    { t: "13:41:42", m: "POST", p: "/v1/geocode/reverse", s: 200, ms: 19, ip: "188.42.16.7", key: "sk_live_qm9z", body: "{\"lat\":59.93,\"lon\":30.32}", req: "req_2v6m4ti" },
    { t: "13:41:38", m: "POST", p: "/v1/suggest/address", s: 200, ms: 14, ip: "85.21.84.12", key: "sk_live_a1b2", body: "{\"query\":\"екб ленина\"}", req: "req_2v6m4te" },
  ],
  invoices: [
    { id: "INV-2026-005", period: "май 2026",    amount: "9 800",  status: "оплачен",   date: "12.05.2026" },
    { id: "INV-2026-004", period: "апрель 2026", amount: "9 800",  status: "оплачен",   date: "12.04.2026" },
    { id: "INV-2026-003", period: "март 2026",   amount: "9 800",  status: "оплачен",   date: "12.03.2026" },
    { id: "INV-2026-002", period: "февраль 2026",amount: "9 800",  status: "оплачен",   date: "12.02.2026" },
    { id: "INV-2026-001", period: "январь 2026", amount: "9 800",  status: "оплачен",   date: "12.01.2026" },
    { id: "INV-2025-012", period: "декабрь 2025",amount: "9 800",  status: "оплачен",   date: "12.12.2025" },
  ],
  team: [
    { name: "Артём Воронцов", email: "a.vorontsov@npd.io", role: "Владелец", initials: "АВ", added: "12 дек 2025" },
    { name: "Мария Кравцова", email: "m.kravtsova@npd.io", role: "Админ",    initials: "МК", added: "08 янв 2026" },
    { name: "Дмитрий Ясин",   email: "d.yasin@npd.io",     role: "Разработчик", initials: "ДЯ", added: "21 фев 2026" },
    { name: "Сергей Лосев",   email: "s.losev@npd.io",     role: "Биллинг",  initials: "СЛ", added: "05 мар 2026" },
  ],
};

window.__CAB = CAB;
