export interface DockTab {
  key: string;
  label: string;
}

export interface AppState {
  /** 桌面端侧边栏折叠 */
  sidebarCollapsed: boolean;
  /** 移动端导航抽屉 */
  mobileDrawerOpen: boolean;
  /** 菜单展开的分组 key */
  menuOpenKeys: string[];
  /** AI 助理抽屉 */
  aiChatOpen: boolean;
  /** AI 请求处理中 */
  aiWorking: boolean;
  /** 路由页签（RouteDock） */
  routeDockTabs: DockTab[];
}

export interface AppActions {
  toggleSidebar: () => void;
  setSidebarCollapsed: (collapsed: boolean) => void;
  setMobileDrawerOpen: (open: boolean) => void;
  /** 函数式更新，与 setState 语义一致 */
  setMenuOpenKeys: (keys: string[] | ((current: string[]) => string[])) => void;
  setAiChatOpen: (open: boolean) => void;
  setAiWorking: (working: boolean) => void;
  /** 函数式更新，与 setState 语义一致 */
  setRouteDockTabs: (updater: DockTab[] | ((current: DockTab[]) => DockTab[])) => void;
}

export type AppStore = AppState & AppActions;

/** 持久化子集 */
export interface AppPersistedState {
  sidebarCollapsed: boolean;
  routeDockTabs: DockTab[];
}
