/**
 * Event type constants for job events
 * These events are emitted throughout the job lifecycle and stored immutably
 */

// Job lifecycle events
export const JOB_CREATED = "job.created";
export const JOB_QUEUED = "job.queued";
export const JOB_STARTED = "job.started";
export const JOB_PROGRESS = "job.progress";
export const JOB_COMPLETED = "job.completed";
export const JOB_FAILED = "job.failed";
export const JOB_CANCELLED = "job.cancelled";

// Step lifecycle events
export const STEP_STARTED = "step.started";
export const STEP_PROGRESS = "step.progress";
export const STEP_OUTPUT = "step.output";
export const STEP_COMPLETED = "step.completed";
export const STEP_FAILED = "step.failed";

// AI events
export const AI_TOOL_CALLED = "ai.tool_called";
export const AI_TOKENS_USED = "ai.tokens_used";
export const AI_ARTIFACT_CREATED = "ai.artifact_created";

// Gate events
export const GATE_STARTED = "gate.started";
export const GATE_PASSED = "gate.passed";
export const GATE_FAILED = "gate.failed";

/**
 * All valid event types
 */
export const ALL_EVENT_TYPES = [
  // Job lifecycle
  JOB_CREATED,
  JOB_QUEUED,
  JOB_STARTED,
  JOB_PROGRESS,
  JOB_COMPLETED,
  JOB_FAILED,
  JOB_CANCELLED,
  // Step lifecycle
  STEP_STARTED,
  STEP_PROGRESS,
  STEP_OUTPUT,
  STEP_COMPLETED,
  STEP_FAILED,
  // AI events
  AI_TOOL_CALLED,
  AI_TOKENS_USED,
  AI_ARTIFACT_CREATED,
  // Gate events
  GATE_STARTED,
  GATE_PASSED,
  GATE_FAILED,
] as const;

/**
 * Type for event types
 */
export type EventType = (typeof ALL_EVENT_TYPES)[number];
