import { RootLayoutState } from "@/layouts/RootLayout/rootLayoutSlice";

/** 主题 */
class ThemeMode {
    /** 存储键 */
    static _storageKey = 'ybee_eqm_theme_mode';

    /**
     * 保存
     * @param {RootLayoutState} themeMode
     */
    public static set(themeMode: RootLayoutState) {
        localStorage.setItem(this._storageKey, JSON.stringify(themeMode));
    }
    /**
     * 获取
     */
    public static get() {
        const res = localStorage.getItem(this._storageKey);
        if (res) {
            return JSON.parse(res) as RootLayoutState;
        }
        return undefined;
    }
    /**
     * 移出
     */
    public static clear() {
        return localStorage.removeItem(this._storageKey);
    }
}

export default ThemeMode;