/**
 * Log levels in order of severity (lowest to highest)
 */
export type LogLevel = 'debug' | 'info' | 'warn' | 'error' | 'fatal';

/**
 * Contextual metadata attached to log entries
 */
export interface LogContext {
  /** Unique session identifier for correlation */
  sessionId?: string;
  /** Current automation step (1-18) */
  stepId?: number;
  /** Step name for human readability */
  stepName?: string;
  /** Adapter or component name */
  adapter?: string;
  /** Operation duration in milliseconds */
  durationMs?: number;
  /** Additional arbitrary metadata */
  [key: string]: unknown;
}

/**
 * ILogger - Port interface for application-layer logging.
 */
export interface ILogger {
  debug(message: string, context?: LogContext): void;
  info(message: string, context?: LogContext): void;
  warn(message: string, context?: LogContext): void;
  error(message: string, error?: Error, context?: LogContext): void;
  fatal(message: string, error?: Error, context?: LogContext): void;
  child(context: LogContext): ILogger;
  flush(): Promise<void>;
}