export type LocaleCode = "zh-CN" | "en-US";

export type WindowControlAction = "minimize" | "toggle-maximize" | "close";

export type ConnectionState = "online" | "connecting" | "offline";

export type StageStatusTone = "ok" | "warn" | "idle";
export type HudNoticeTone = "ok" | "warn" | "info";

export type SignalTone = "cyan" | "lime" | "orange" | "violet" | "gold" | "rose";
export type PressureColorMapPreset = "emerald" | "arctic" | "ember";

export type SignalPanelSide = "left" | "right";

export type HudConfigTone = "neutral" | "cyan" | "lime" | "orange";

export interface HudSignalSeries {
  id: string;
  tone: SignalTone;
  points: number[];
}

export interface HudSignalIcon {
  id: string;
  label: string;
  tone: SignalTone;
}

export interface HudSignalPanel {
  id: string;
  code: string;
  title: string;
  side: SignalPanelSide;
  active: boolean;
  series: HudSignalSeries[];
  icons: HudSignalIcon[];
  latest: number | null;
  min: number | null;
  max: number | null;
}

export interface HudPacket {
  ts: number;
  panels: HudSignalPanel[];
  summary: HudSummary;
  pressureMatrix: number[] | null;
}

export interface HudSummary {
  label: string;
  xValues?: number[];
  points: number[];
  latest: number | null;
  min: number | null;
  max: number | null;
}

export interface HudConfigLink {
  id: string;
  label: string;
  tone?: HudConfigTone;
  active?: boolean;
}

export interface HudColorMapOption {
  id: PressureColorMapPreset;
  label: string;
  previewStops: [string, string, string];
}

export interface HudCopy {
  appName: string;
  suiteName: string;
  stageTitle: string;
  stageHint: string;
  configPanelTitle: string;
  configPanelHint: string;
  matrixSizeLabel: string;
  matrixRowsLabel: string;
  matrixColsLabel: string;
  rangeLabel: string;
  rangeMinLabel: string;
  rangeMaxLabel: string;
  colorMapLabel: string;
  resetConfigLabel: string;
  applyLiveHint: string;
  runtimeReady: string;
  runtimeFallback: string;
  controlArea: string;
  serialPortLabel: string;
  connectionLabel: string;
  deviceLabel: string;
  sampleRateLabel: string;
  channelsLabel: string;
  configLinksLabel: string;
  refreshPortsLabel: string;
  connectActionLabel: string;
  disconnectActionLabel: string;
  exportActionLabel: string;
  exportingActionLabel: string;
  importActionLabel: string;
  fileExplorerImportTitle: string;
  fileExplorerExportTitle: string;
  fileExplorerPathLabel: string;
  fileExplorerNameLabel: string;
  fileExplorerCancelLabel: string;
  fileExplorerOpenLabel: string;
  fileExplorerSaveLabel: string;
  fileExplorerEmptyHint: string;
  fileExplorerCsvHint: string;
  fileExplorerLoadingLabel: string;
  fileExplorerUpLabel: string;
  fileExplorerNameColumnLabel: string;
  fileExplorerSizeColumnLabel: string;
  fileExplorerModifiedColumnLabel: string;
  replaySectionLabel: string;
  replayPlayLabel: string;
  replayPauseLabel: string;
  replayStopLabel: string;
  replaySpeedLabel: string;
  replayProgressLabel: string;
  replayEmptyHint: string;
  connectedLabel: string;
  connectingLabel: string;
  disconnectedLabel: string;
}

export interface HudMatrixConfig {
  rows: number;
  cols: number;
  rangeMin: number;
  rangeMax: number;
  colorMapPreset: PressureColorMapPreset;
}

export interface SerialConnectResult {
  port: string;
  connected: boolean;
  message: string;
}

export interface SerialExportResult {
  path: string;
  frameCount: number;
  message: string;
}

export interface SerialRecordStateResult {
  hasData: boolean;
  frameCount: number;
}

export interface SerialImportFrameResult {
  data: number[];
  dtsMs: number;
}

export interface SerialImportResult {
  fileName: string;
  frameCount: number;
  channelCount: number;
  frames: SerialImportFrameResult[];
  message: string;
}

export interface FileExplorerRoot {
  label: string;
  path: string;
}

export interface FileExplorerEntry {
  name: string;
  path: string;
  isDir: boolean;
  sizeBytes: number | null;
  modifiedMs: number | null;
}

export interface FileExplorerListResult {
  currentPath: string;
  parentPath: string | null;
  roots: FileExplorerRoot[];
  entries: FileExplorerEntry[];
}
