const getters = {
  sidebar: state => state.app.sidebar,
  size: state => state.app.size,
  device: state => state.app.device,
  visitedViews: state => state.tagsView.visitedViews,
  cachedViews: state => state.tagsView.cachedViews,
  currentUser: state => state.user,
  token: state => state.user.token,
  avatar: state => state.user.avatar,
  name: state => state.user.name,
  nickName: state => state.user.nickName,
  introduction: state => state.user.introduction,
  school: state => state.user.busiSchool?.first(),
  firstClassName: state => state.user.busiSchool?.first()?.grade?.first()?.clazz?.first()?.className,
  roleList: state => state.user.roleList || [],
  roles: (state, getters) => getters.roleList.map(r => r.roleKey),
  currentRole: (state, getters) => getters.roleList.find(r => r.isCurrentRole),
  isFrontStudent: (state, getters) => getters.currentRole?.roleKey == 'frontStudent',
  isFrontTeacher: (state, getters) => getters.currentRole?.roleKey == 'frontTeacher',
  isFrontHeadteacher: (state, getters) => getters.currentRole?.roleKey == 'frontHeadteacher',
  isFrontMaster: (state, getters) => getters.currentRole?.roleKey == 'frontMaster',
  isAdmin: (state, getters) => getters.currentRole?.roleKey == 'admin',
  isCommon: (state, getters) => getters.currentRole?.roleKey == 'common',
  isSenior: state => state.user.period == 'senior',
  isJunior: state => state.user.period == 'junior',
  isPrimary: state => state.user.period == 'primary',
  period: state => state.user.period,
  permissions: state => state.user.permissions,
  permission_routes: state => state.permission.routes,
  topbarRouters: state => state.permission.topbarRouters,
  defaultRoutes: state => state.permission.defaultRoutes,
  sidebarRouters: state => state.permission.sidebarRouters,
  isWideScreen: state => state.permission.isWideScreen,
  studentParams: state => state.settings.studentParams
}
export default getters
