export interface Page {
  id: string
  title: string
  desc: string
  screen: number
  ctrl: number
  display: boolean
  url: string
  params: string
  /** 页面截图预览（Base64 dataURL），来自当前 URL 页面的截图 */
  preview?: string
}

export interface PlayingInfo {
  title: string
  url: string
}

export interface ScreenInfo {
  index: number
  name: string
  res: string
  pos: string
  primary: boolean
  playing: PlayingInfo | null
}

export interface PageFile {
  PageID: string
  PageTitle: string
  PageDescribe: string
  ScreenIndex: number
  ControllerIndex: number
  IsDisplay: boolean
  PageUrl: string
  PageParams: string
  /** 页面截图预览（Base64 dataURL），持久化到 JSON */
  PagePreview?: string
}

export interface ProjectJson {
  appName?: string
  version?: string
  pages?: PageFile[]
}

export type ViewMode = 'edit' | 'config'

export interface PublishDefaults {
  mode: 'multi' | 'single' | 'main'
  screenIndex: number
  alsoMain: boolean
  intervalSec: number
}

export interface AppSettings {
  projectName: string
  projectVersion: string
  jsonPassword: string
  keyThreshold: number
  keyLockKey: string
  publish: PublishDefaults
  /** 上次打开/另存为工程的文件夹（主进程记忆） */
  lastDir?: string
}

export interface LoadPayload {
  path: string
  json: ProjectJson | null
  mode: 'edit' | 'publish'
}

export interface AppInfo {
  appVersion: string
  electron: string
  chrome: string
  node: string
  platform: string
}
