import { createStore } from 'vuex'
// import { ActionContext } from 'vuex'
import type { App } from 'vue'


// 定义 RootState 接口（可扩展）
interface RootState {
  count: number,
  managerHorizontalMenuItems:any[],
  siderNav:any[]
}



// type StoreActionContext = ActionContext<RootState, RootState>
// 创建 store 实例
const store = createStore<RootState>({
  state: () => ({
    count: 0,
    // 管理员 评教评学 的访问菜单
    managerHorizontalMenuItems:[],
    siderNav:[
      {
        title: '预约待办',
        route: '/main',
        svgIcon:undefined,
      },
      {
        title: '公海客户',
        route: '/main/highSeasCustomer',
        svgIcon:undefined,
      },
      {
        title: '我的客户',
        route: '/main/myCustomer',
        svgIcon:undefined,
      },
      {
        title: '客户跟进',
        route: '/main/customerFollowUp',
        svgIcon:undefined,
      },
      {
        title: '参数配置',
        route: '/main/parameterConfig',
        svgIcon:undefined,
      },
      {
        title: '用户权限',
        route: '/main/userPrivilegeManagement',
        svgIcon:undefined,
      },
    ]
  }),
  mutations: {
    increment(state: RootState) {
      state.count++
    },
  },
  actions: {
    increment({ commit }) {
      commit('increment')
    },
  },
  getters: {
    count: (state: RootState) => state.count,
    getDemo:(state)=>()=>{
      return  state.managerHorizontalMenuItems.map(item=>{
          return item
      })
    },
  }
})

// 提供一个方法用于注册到 Vue 应用中
export function setupStore(app: App) {
  app.use(store)
}

export default store