import type { StateCreator } from "zustand";
import type { AppState } from "../types";

export type UiSlice = Pick<
    AppState,
    "selectedDevice" | "selectedFile" | "setSelectedDevice" | "setSelectedFile"
>;

// 当前 UI slice 仅承载首页 composer 所需的"选中设备"与"选中文件"。后续若
// 需要更多 UI 临时态（开关、临时表单、拖拽态），都收拢在此处。
export const createUiSlice: StateCreator<AppState, [], [], UiSlice> = (set) =>
({
    selectedDevice: null,
    selectedFile: null,
    setSelectedDevice: (n) => set({ selectedDevice: n }),
    setSelectedFile: (f) => set({ selectedFile: f }),
});
