import type { SimEvent } from './events.ts'; import type { ClientConfig, ServerConfig, DatabaseConfig, CacheConfig, LoadBalancerConfig, QueueConfig, ThrottleConfig } from './configs.ts'; /** Supported component types */ export declare enum ComponentType { CLIENT = "client", LOAD_BALANCER = "load-balancer", SERVER = "server", CACHE = "cache", DATABASE = "database", QUEUE = "queue", THROTTLE = "throttle" } /** Union of all component configurations, discriminated by type */ export type ComponentConfig = ({ type: ComponentType.CLIENT; } & ClientConfig) | ({ type: ComponentType.SERVER; } & ServerConfig) | ({ type: ComponentType.DATABASE; } & DatabaseConfig) | ({ type: ComponentType.CACHE; } & CacheConfig) | ({ type: ComponentType.LOAD_BALANCER; } & LoadBalancerConfig) | ({ type: ComponentType.QUEUE; } & QueueConfig) | ({ type: ComponentType.THROTTLE; } & ThrottleConfig); /** Per-component metrics snapshot */ export interface ComponentMetrics { [metricName: string]: number; } /** Context provided by the engine to components during event processing */ export interface SimContext { currentTime: number; scheduleEvent(event: SimEvent): void; getComponent(id: string): SimComponent; getDownstream(componentId: string): string[]; random(): number; nextId(): string; recordMetric(componentId: string, name: string, value: number, time: number): void; } /** Common interface implemented by every simulation component */ export interface SimComponent { readonly id: string; readonly type: ComponentType; readonly config: ComponentConfig; /** Process an incoming event, return zero or more new events */ handleEvent(event: SimEvent, context: SimContext): SimEvent[]; /** Return current metrics snapshot for this component */ getMetrics(): ComponentMetrics; /** Reset component to initial state */ reset(): void; } //# sourceMappingURL=components.d.ts.map