/**
 * Types for shutdown functionality
 */

/**
 * Callback function for shutdown cleanup
 */
export type ShutdownCallback = () => Promise<void> | void;

/**
 * Shutdown callback with priority information
 */
export interface PrioritizedShutdownCallback {
  callback: ShutdownCallback;
  priority: number;
  name?: string;
}

/**
 * Options for configuring shutdown behavior
 */
export interface ShutdownOptions {
  /** Timeout in milliseconds before forcing shutdown (default: 30000) */
  timeout?: number;
  /** Whether to automatically register signal handlers (default: true) */
  autoRegister?: boolean;
}

/**
 * Shutdown result information
 */
export interface ShutdownResult {
  /** Whether shutdown completed successfully */
  success: boolean;
  /** Number of callbacks executed */
  callbacksExecuted: number;
  /** Number of callbacks that failed */
  callbacksFailed: number;
  /** Time taken for shutdown in milliseconds */
  duration: number;
  /** Error message if shutdown failed */
  error?: string;
}
