export interface MeasurementPointState { id: string; sensorId: string; label: string; zone: string; x: number; y: number; pin: number; currentValue: number; lastUpdateTime: Date; warningThreshold: number; alarmThreshold: number; warningDelayMs: number; status: 'normal' | 'warning' | 'alarm' | 'offline'; } export interface AlertState { id: string; measurementPointId: string; type: 'WARNING' | 'ALARM'; value: number; threshold: number; acknowledged: boolean; silenced: boolean; startTime: Date; endTime?: Date; sensorLabel: string; zone: string; } export interface SystemStatus { mqttConnected: boolean; databaseConnected: boolean; lastHeartbeat: Date; activeConnections: number; totalMeasurementPoints: number; activeSensors: number; } export interface FrontendState { // Measurement points and sensor data measurementPoints: Record; // Active alerts alerts: Record; // System status system: SystemStatus; } // State update events export interface StateUpdateEvent { type: 'FULL_STATE' | 'PARTIAL_UPDATE' | 'SENSOR_UPDATE' | 'ALERT_UPDATE' | 'SYSTEM_UPDATE'; timestamp: Date; data: Partial | MeasurementPointState | AlertState | SystemStatus; } // WebSocket message types export interface WebSocketMessage { type: 'STATE_UPDATE' | 'HEARTBEAT' | 'ERROR' | 'ACKNOWLEDGE_ALERT' | 'SILENCE_ALERT'; payload: StateUpdateEvent | { alertId: string } | { message: string }; timestamp: Date; }