
import { observable } from 'mobx';
import GlobalEvent from './globalEvent';
import type { MenuDataItem } from '@ant-design/pro-layout';
import type { CurrentUser } from '@/models/user';
import type { NoticeItem } from '@/models/global';

// 全局状态类
type initStateType = {
  // 当前用户数据
  currentUser: CurrentUser | undefined,
  // 当前菜单数据
  menuData: MenuDataItem[] | undefined,
  // 当前通知
  notices: NoticeItem[] | undefined,
  // 全局事件实例
  globalEvent: any
}

// 创建全局状态
const globalState = observable.map({
  currentUser: undefined,
  menuData: undefined,
  notices: undefined,
  globalEvent: new GlobalEvent()
} as initStateType);

export default globalState;