import type { KbxTelemetryEventName } from './generated/telemetryCatalog'

export type KbxTelemetryCategory = 'navigation' | 'task' | 'interaction' | 'command' | 'lookup' | 'quality' | 'excel' | 'exception' | 'ai' | 'outcome' | 'experiment'

export interface KbxUxEvent {
  eventName: KbxTelemetryEventName
  screenId?: string
  screenVersion?: string
  sessionId: string
  taskSessionId?: string
  appVersion?: string
  experimentId?: string
  experimentVariant?: string
  occurredAt: string
  durationMs?: number
  count?: number
  attributes?: Record<string, string>
}

export interface KbxUxEventBatch {
  events: KbxUxEvent[]
}

export interface KbxUxMetricRow {
  metricKey: string
  label: string
  value: number | null
  unit: 'ms' | 'percent' | 'count'
  sampleCount: number
  p50?: number | null
  p95?: number | null
}

export interface KbxUxMetricsResponse {
  from: string
  to: string
  screenId?: string | null
  metrics: KbxUxMetricRow[]
}

export interface KbxUxWorkloadOutcome {
  workType: string
  observedCount: number
  autoProcessedCount: number
  manualInterventionCount: number
  reasonCode?: string
}
