import type { DeptTreeNode } from '@/views/system/dept/dept-interface'

interface approvalStatus {
  [key: string]: string
}
const useDictStore = defineStore(
  'dict',
  {
    state: () => ({
      allDeptList: [] as DeptTreeNode[], // 所有部门列表
      companyList: [] as DeptTreeNode[], // 公司列表
      approvalStatusList: {
        全部: '',
        草稿箱: '1',
        待审批: '2',
        审批中: '3',
        已通过: '4',
        未通过: '5',
        已取消: '6',
      } as approvalStatus, // 审批状态
      approvalStatusListTow: {
        全部: '0',
        草稿箱: '1',
        待审批: '2',
        审批中: '3',
        已通过: '4',
        未通过: '5',
        已取消: '6',
      } as approvalStatus, // 审批状态
    }),
    getters: {
      getAllDeptList: (state) => {
        return state.allDeptList
      },
      getCompanyList: (state) => {
        return state.companyList
      },
      getApprovalStatus: (state) => {
        return state.approvalStatusList
      },
    },
    actions: {
      setAllDeptList(list: DeptTreeNode[]) {
        this.allDeptList = list
      },
      setAllCompanyList(list: DeptTreeNode[]) {
        this.allDeptList = list
      },
    },
  },
)

export default useDictStore
