export default {
  namespaced: true,
  state: {
    locale: "zh_CN",
    languages: [
      { label: "中文简体", value: "zh_CN" },
      { label: "中文繁体", value: "zh_TW" },
      { label: "English", value: "en" },
    ],
    systemConfig: {}, // 系统基础设置
    systemCodeRule: {}, // 系统编码规则
    i18nReady: false, // 判断国际化是否准备就绪
    isFullOrSmall: false, // 全屏与正常屏默认正常
    isAppendRoute: false, // 是否动态添加过路由
  },
  mutations: {
    SET_LANGUAGES(state, value) {
      // eslint-disable-next-line no-param-reassign
      state.languages = value;
    },
    SET_LOCALE(state, value) {
      // eslint-disable-next-line
      state.locale = value;
    },
    SET_SYSTEM_CONFIG(state, payload) {
      // eslint-disable-next-line
      state.systemConfig = payload;
    },
    SET_SYSTEM_CODE_RULE(state, payload) {
      // eslint-disable-next-line
      state.systemCodeRule = payload;
    },
    SET_I18N_READY(state, payload) {
      // eslint-disable-next-line
      state.i18nReady = payload;
    },
    SET_FULL_SMALL(state, payload) {
      // eslint-disable-next-line
      state.isFullOrSmall = payload;
    },
    SET_IS_APPEND_ROUTE(state, status) {
      // eslint-disable-next-line no-param-reassign
      state.isAppendRoute = status;
    },
  },
  actions: {
    setSidebar: ({ commit }, type) => {
      commit("SET_SIDEBAR_TYPE", type);
    },
    CloseSidebar({ commit }, { withoutAnimation }) {
      commit("CLOSE_SIDEBAR", withoutAnimation);
    },
    ToggleDevice({ commit }, device) {
      commit("TOGGLE_DEVICE", device);
    },
    ToggleTheme({ commit }, theme) {
      commit("TOGGLE_THEME", theme);
    },
    ToggleLayoutMode({ commit }, mode) {
      commit("TOGGLE_LAYOUT_MODE", mode);
    },
    ToggleFixedHeader({ commit }, fixedHeader) {
      commit("TOGGLE_FIXED_HEADER", fixedHeader);
    },
    ToggleFixSidebar({ commit }, fixSidebar) {
      commit("TOGGLE_FIXED_SIDEBAR", fixSidebar);
    },
    ToggleFixedHeaderHidden({ commit }, show) {
      commit("TOGGLE_FIXED_HEADER_HIDDEN", show);
    },
    ToggleContentWidth({ commit }, type) {
      commit("TOGGLE_CONTENT_WIDTH", type);
    },
    ToggleColor({ commit }, color) {
      commit("TOGGLE_COLOR", color);
    },
    ToggleWeak({ commit }, weakFlag) {
      commit("TOGGLE_WEAK", weakFlag);
    },
    ToggleMultiPage({ commit }, multiPageFlag) {
      commit("SET_MULTI_PAGE", multiPageFlag);
    },
    SetSidebarWidth({ commit }, sidebarWidth) {
      commit("SET_SIDEBAR_WIDTH", sidebarWidth);
    },
  },
};
