import type { components } from '../../api/schema';

export type ExecutionDetail = components['schemas']['ExecutionDetail'] & {
  /** Environment slug this exchange was recorded in. Added to the backend record; schema.d.ts will pick it up on next openapi regen. */
  environment?: string;
};
export type ProcessorNode = components['schemas']['ProcessorNode'];

export interface NodeExecutionState {
  status: 'COMPLETED' | 'FAILED';
  durationMs: number;
  /** True if this node's target sub-route failed (DIRECT/SEDA) */
  subRouteFailed?: boolean;
  /** True if trace data is available for this processor */
  hasTraceData?: boolean;
  /** Runtime-resolved endpoint URI (for TO_DYNAMIC, etc.) */
  resolvedEndpointUri?: string;
  /** Filter processor: true if predicate matched, false if message was rejected */
  filterMatched?: boolean;
  /** Idempotent consumer: true if duplicate message detected and children skipped */
  duplicateMessage?: boolean;
}

export interface IterationInfo {
  /** Current iteration index (0-based) */
  current: number;
  /** Total number of iterations */
  total: number;
  /** Type of iteration (determines label) */
  type: 'loop' | 'split' | 'multicast';
}

export type DetailTab = 'info' | 'headers' | 'properties' | 'input' | 'output' | 'error' | 'config' | 'timeline' | 'log';
