import type { FrontMcpMetadata } from '../metadata';
import type { RawMetadataShape } from '../types';
import { tokenFactory } from './base.tokens';

export const FrontMcpTokens: RawMetadataShape<FrontMcpMetadata> = {
  type: tokenFactory.type('root'),
  info: tokenFactory.meta('info'),
  // Captured call-site dir (#469) — anchors auth.ui relative paths.
  __sourceDir: tokenFactory.meta('__sourceDir'),
  instructions: tokenFactory.meta('instructions'),
  apps: tokenFactory.meta('apps'),
  http: tokenFactory.meta('http'),
  redis: tokenFactory.meta('redis'),
  pubsub: tokenFactory.meta('pubsub'),
  transport: tokenFactory.meta('transport'),
  serve: tokenFactory.meta('serve'),
  splitByApp: tokenFactory.meta('splitByApp'),
  auth: tokenFactory.meta('auth'),
  logging: tokenFactory.meta('logging'),

  // global scoped providers
  providers: tokenFactory.meta('providers'),
  // global scoped tools (shared across apps)
  tools: tokenFactory.meta('tools'),
  // global scoped resources (shared across apps)
  resources: tokenFactory.meta('resources'),
  // global scoped skills (shared across apps)
  skills: tokenFactory.meta('skills'),
  // server-level plugins (instantiated per scope)
  plugins: tokenFactory.meta('plugins'),
  // pagination configuration
  pagination: tokenFactory.meta('pagination'),
  // elicitation configuration
  elicitation: tokenFactory.meta('elicitation'),
  // skills HTTP configuration
  skillsConfig: tokenFactory.meta('skillsConfig'),
  // ext-apps configuration
  extApps: tokenFactory.meta('extApps'),
  // sqlite storage configuration
  sqlite: tokenFactory.meta('sqlite'),
  // UI kit configuration
  ui: tokenFactory.meta('ui'),
  // jobs and workflows configuration
  jobs: tokenFactory.meta('jobs'),
  // default package loader for ESM apps
  loader: tokenFactory.meta('loader'),
  // rate limiting, concurrency control, and timeout
  throttle: tokenFactory.meta('throttle'),
  // observability (tracing, structured logging, request logs)
  observability: tokenFactory.meta('observability'),
  // health and readiness endpoints
  health: tokenFactory.meta('health'),
  // /metrics endpoint (issue #397)
  metrics: tokenFactory.meta('metrics'),
  // channels configuration (Claude Code notifications)
  channels: tokenFactory.meta('channels'),
  // authorities configuration (RBAC/ABAC/ReBAC)
  authorities: tokenFactory.meta('authorities'),
  // background tasks configuration (MCP 2025-11-25 tasks spec)
  tasks: tokenFactory.meta('tasks'),
  // output validation policy (e.g., reject non-finite numeric output)
  output: tokenFactory.meta('output'),
};
