export interface BaseEvent {
  id: string;
  tenantId: string;
  timestamp: Date;
  source: string;
}

export interface CommandExecutedEvent extends BaseEvent {
  type: 'command.executed';
  payload: {
    sessionId: string;
    command: string;
    riskLevel: number;
    output: string;
  };
}

export interface ApprovalRequiredEvent extends BaseEvent {
  type: 'approval.required';
  payload: {
    taskId: string;
    command: string;
    riskLevel: number;
    targetServer: string;
    expiresAt: Date;
  };
}

export interface AlertFiredEvent extends BaseEvent {
  type: 'alert.fired';
  payload: {
    ruleId: string;
    serverId: string;
    severity: 'info' | 'warning' | 'critical' | 'fatal';
    message: string;
    metricValue: number;
  };
}

export interface TaskCompletedEvent extends BaseEvent {
  type: 'task.completed';
  payload: {
    taskId: string;
    result: 'success' | 'failure' | 'partial';
    summary: string;
  };
}

export interface StandingOrderExecutedEvent extends BaseEvent {
  type: 'standing.order.executed';
  payload: {
    orderId: string;
    executionId: string;
    status: 'completed' | 'failed' | 'awaiting_human';
    summary?: string;
  };
}

export type IT0Event =
  | CommandExecutedEvent
  | ApprovalRequiredEvent
  | AlertFiredEvent
  | TaskCompletedEvent
  | StandingOrderExecutedEvent;
