/* Product-surface sample data. The source document specifies the product's surface stack,
   type scale, scrollbars, shadows and categorical key, but contains no product screens —
   so these views demonstrate those documented rules rather than recreating a specific
   screen. Nothing here is invented layout borrowed from another product. */

const NAV_GROUPS = [
  {
    heading: "Observability",
    items: [
      { id: "runs", label: "Runs", icon: "history", color: "var(--color-cat-indigo)" },
      { id: "batches", label: "Batches", icon: "boxes", color: "var(--color-cat-pink)" },
      { id: "logs", label: "Logs", icon: "scroll-text", color: "var(--color-cat-pink)" },
    ],
  },
  {
    heading: "Configure",
    items: [
      { id: "tasks", label: "Tasks", icon: "square-code", color: "var(--color-cat-blue)" },
      { id: "schedules", label: "Schedules", icon: "calendar-clock", color: "var(--color-cat-sun)" },
      { id: "queues", label: "Queues", icon: "layers", color: "var(--color-cat-purple)" },
      { id: "webhooks", label: "Webhooks", icon: "webhook", color: "var(--color-cat-teal)" },
      { id: "alerts", label: "Alerts", icon: "bell", color: "var(--color-cat-red)" },
    ],
  },
  {
    heading: "Deploy",
    items: [
      { id: "deployments", label: "Deployments", icon: "rocket", color: "var(--color-cat-green)" },
      { id: "regions", label: "Regions", icon: "map-pin", color: "var(--color-cat-green)" },
    ],
  },
];

const STATUS = {
  completed: { label: "Completed", color: "var(--color-success)" },
  executing: { label: "Executing", color: "var(--color-pending)" },
  waiting: { label: "Waiting", color: "var(--color-cat-purple)" },
  failed: { label: "Failed", color: "var(--color-error)" },
  queued: { label: "Queued", color: "var(--color-cat-neutral)" },
};

const RUNS = [
  { id: "run_a91f2c74", task: "summarize-document", status: "completed", duration: "4.2s", started: "12:04:19", version: "20260304.4", env: "prod", attempt: 1, queue: "default" },
  { id: "run_a91f2c73", task: "transcode-upload", status: "executing", duration: "1m 12s", started: "12:03:51", version: "20260304.4", env: "prod", attempt: 1, queue: "media" },
  { id: "run_a91f2c72", task: "publish-with-approval", status: "waiting", duration: "2h 04m", started: "10:00:02", version: "20260304.4", env: "prod", attempt: 1, queue: "default" },
  { id: "run_a91f2c71", task: "send-campaign", status: "completed", duration: "38s", started: "09:41:10", version: "20260304.3", env: "prod", attempt: 1, queue: "campaigns" },
  { id: "run_a91f2c70", task: "score-batch", status: "failed", duration: "12.8s", started: "09:12:44", version: "20260304.3", env: "staging", attempt: 2, queue: "default" },
  { id: "run_a91f2c6f", task: "crawl-listing", status: "completed", duration: "9.1s", started: "08:58:07", version: "20260304.3", env: "prod", attempt: 1, queue: "browser" },
  { id: "run_a91f2c6e", task: "ingest-documents", status: "queued", duration: "—", started: "08:57:55", version: "20260304.3", env: "prod", attempt: 1, queue: "tenant" },
  { id: "run_a91f2c6d", task: "summarize-document", status: "completed", duration: "3.8s", started: "08:41:30", version: "20260304.3", env: "prod", attempt: 1, queue: "default" },
  { id: "run_a91f2c6c", task: "research-agent", status: "completed", duration: "6m 02s", started: "08:12:19", version: "20260304.3", env: "prod", attempt: 1, queue: "agents" },
];

const RUN_STEPS = {
  default: [
    { label: "trigger", detail: "Payload accepted", status: "completed", duration: "2ms", type: "action" },
    { label: "queue", detail: "default · concurrency 8", status: "completed", duration: "18ms", type: "router" },
    { label: "attempt 1", detail: "Executing on large-1x", status: "completed", duration: "4.1s", type: "control" },
    { label: "model.summarize", detail: "1,284 input tokens", status: "completed", duration: "3.4s", type: "parallel" },
    { label: "output", detail: "Stored to run history", status: "completed", duration: "6ms", type: "neutral" },
  ],
  failed: [
    { label: "trigger", detail: "Payload accepted", status: "completed", duration: "2ms", type: "action" },
    { label: "queue", detail: "default · concurrency 8", status: "completed", duration: "22ms", type: "router" },
    { label: "attempt 1", detail: "TimeoutError after 30s", status: "failed", duration: "30.0s", type: "control" },
    { label: "backoff", detail: "Retrying in 4s (factor 2)", status: "completed", duration: "4.0s", type: "neutral" },
    { label: "attempt 2", detail: "TimeoutError after 30s", status: "failed", duration: "30.0s", type: "control" },
  ],
};

const LOGS = {
  default: [
    "12:04:19.104  info   run started · attempt 1 · large-1x",
    "12:04:19.121  debug  fetched document doc_7741 (18.2 kB)",
    "12:04:19.480  info   model.summarize · 1284 input tokens",
    "12:04:22.902  info   model.summarize · 214 output tokens",
    "12:04:23.310  info   run completed in 4.2s",
  ].join("\n"),
  failed: [
    "09:12:44.008  info   run started · attempt 1 · large-1x",
    "09:12:44.219  debug  loaded 4,120 rows",
    "09:13:14.010  error  TimeoutError: model.score exceeded 30s",
    "09:13:14.011  info   retrying in 4s (attempt 2 of 3)",
    "09:13:18.020  info   run started · attempt 2 · large-1x",
    "09:13:48.204  error  TimeoutError: model.score exceeded 30s",
  ].join("\n"),
};

const TASKS = [
  { id: "summarize-document", type: "task", queue: "default", lastRun: "2m ago", runs24h: 412, icon: "square-code", color: "var(--color-cat-blue)" },
  { id: "transcode-upload", type: "task", queue: "media", lastRun: "3m ago", runs24h: 96, icon: "film", color: "var(--color-cat-magenta)" },
  { id: "publish-with-approval", type: "task", queue: "default", lastRun: "2h ago", runs24h: 14, icon: "user-check", color: "var(--color-cat-blue)" },
  { id: "nightly-sync", type: "schedule", queue: "default", lastRun: "9h ago", runs24h: 1, icon: "calendar-clock", color: "var(--color-cat-sun)" },
  { id: "send-campaign", type: "batch", queue: "campaigns", lastRun: "3h ago", runs24h: 3, icon: "megaphone", color: "var(--color-cat-rose)" },
  { id: "research-agent", type: "task", queue: "agents", lastRun: "4h ago", runs24h: 58, icon: "bot", color: "var(--color-cat-amber)" },
];

const QUEUES = [
  { name: "default", limit: 8, running: 3, queued: 0 },
  { name: "media", limit: 4, running: 4, queued: 12 },
  { name: "agents", limit: 6, running: 2, queued: 0 },
  { name: "campaigns", limit: 20, running: 0, queued: 0 },
  { name: "tenant", limit: 2, running: 2, queued: 41 },
];

Object.assign(window, { NAV_GROUPS, STATUS, RUNS, RUN_STEPS, LOGS, TASKS, QUEUES });
