/**
 * Handler Registry Types
 * Pure types for handler metadata and registration
 */

import type { JobHandler, ScheduledJob } from '@stock-bot/types';

/**
 * Rate limit configuration
 */
export interface RateLimitConfig {
  points: number;
  duration: number;
  blockDuration?: number;
}

/**
 * Metadata for a single operation within a handler
 */
export interface OperationMetadata {
  name: string;
  method: string;
  description?: string;
  rateLimit?: RateLimitConfig | null;
}

/**
 * Metadata for a scheduled operation
 */
export interface ScheduleMetadata {
  operation: string;
  cronPattern: string;
  priority?: number;
  immediately?: boolean;
  description?: string;
}

/**
 * Complete metadata for a handler
 */
export interface HandlerMetadata {
  name: string;
  service?: string;
  operations: OperationMetadata[];
  schedules?: ScheduleMetadata[];
  version?: string;
  description?: string;
  rateLimit?: RateLimitConfig | null;
}

/**
 * Handler configuration with operation implementations
 */
export interface HandlerConfiguration {
  name: string;
  operations: Record<string, JobHandler>;
  scheduledJobs?: ScheduledJob[];
}

/**
 * Registry statistics
 */
export interface RegistryStats {
  handlers: number;
  operations: number;
  scheduledJobs: number;
  services: number;
}

/**
 * Handler discovery result
 */
export interface HandlerDiscoveryResult {
  handler: HandlerMetadata;
  constructor: any;
  filePath?: string;
}
