// Core signal reference: identifies a signal by datasource + name
export interface SignalRef {
  ds: string;
  name: string;
}

// Live value for a signal
export interface SignalValue {
  value: any;
  quality: 'good' | 'uncertain' | 'bad' | 'unknown';
  ts: string | null;
}

// Metadata for a signal (received once on subscribe)
export interface SignalMeta {
  type: string;
  unit?: string;
  displayLow: number;
  displayHigh: number;
  writable: boolean;
  enumStrings?: string[];
  description?: string;
}

// A single widget in an interface
export interface Widget {
  id: string;
  type: string;
  x: number;
  y: number;
  w: number;
  h: number;
  signals: Array<SignalRef & { color?: string }>;
  options: Record<string, string>;
}

// A single data point returned from a history request
export interface HistoryPoint {
  ts: string;
  value: any;
}

// A complete HMI interface definition
export interface Interface {
  id: string;
  name: string;
  version: number;
  w: number;
  h: number;
  widgets: Widget[];
}
