/** 任务条目 */
export interface Task {
  id: string;
  title: string;
  done: boolean;
  createdAt: number;
  order: number;
}

/** 快捷方式四种执行类型 */
export type ShortcutType = "url" | "app" | "cmd" | "powershell";

/** 快捷按钮 */
export interface Shortcut {
  id: string;
  label: string;
  icon: string; // lucide-react 图标名（kebab-case 或 PascalCase 均可，我们统一存 kebab）
  type: ShortcutType;
  target: string;
  args?: string[];
  cwd?: string;
  /** 静默执行（仅 cmd/powershell 生效）：true 隐藏控制台窗口，false 显示新控制台便于查看输出 */
  silent?: boolean;
}

/** 番茄钟配置 */
export interface PomodoroConfig {
  workMin: number;
  breakMin: number;
  soundOn: boolean;
}

/** 全局快捷键映射 */
export interface GlobalHotkeys {
  newTask: string;
  togglePomodoro: string;
  showHide: string;
}

/** 通用设置 */
export interface Settings {
  alwaysOnTop: boolean;
  opacity: number;
  globalHotkeys: GlobalHotkeys;
  autoStart: boolean;
  /** 仅悬浮锁定模式：true 时屏蔽所有交互按钮，避免误触；只能从锁按钮本身解锁 */
  locked: boolean;
}

/** 整个 data.json 的根结构 */
export interface AppState {
  tasks: Task[];
  shortcuts: Shortcut[];
  pomodoro: PomodoroConfig;
  settings: Settings;
}

export const DEFAULT_STATE: AppState = {
  tasks: [],
  shortcuts: [],
  pomodoro: { workMin: 25, breakMin: 5, soundOn: true },
  settings: {
    alwaysOnTop: true,
    opacity: 0.85,
    globalHotkeys: {
      newTask: "Ctrl+Alt+T",
      togglePomodoro: "Ctrl+Alt+P",
      showHide: "Ctrl+Alt+`",
    },
    autoStart: false,
    locked: false,
  },
};
