// Plugin type declarations

export interface PluginMetadata {
  name: string;
  version?: string;
  description?: string;
}

export interface CCRPluginOptions {
  enabled?: boolean;
}

export class CCRPlugin {
  name: string;
  metadata: PluginMetadata;
  options: CCRPluginOptions;
}

export const pluginManager: {
  registerPlugin(plugin: CCRPlugin, options?: any): void;
  enablePlugin(name: string, fastify: any): Promise<void>;
  enablePlugins(fastify: any): Promise<void>;
  getPlugins(): PluginMetadata[];
  getPlugin(name: string): CCRPlugin | undefined;
  hasPlugin(name: string): boolean;
  isPluginEnabled(name: string): boolean;
  setPluginEnabled(name: string, enabled: boolean): void;
  removePlugin(name: string): void;
  clear(): void;
};

export const tokenSpeedPlugin: CCRPlugin;

export function getTokenSpeedStats(sessionId: string): {
  ttft: number | null;
  tokensPerSecond: number | null;
};

export function getGlobalTokenSpeedStats(): {
  avgTtft: number | null;
  avgTokensPerSecond: number | null;
};