import { reactive } from "vue";

type iGlobalState = {
  businessType: number; //0设置  1忘记
  goodsNum: number; // 存证数量
  deletedNum: number; // 回收站数据总量
  selectedStatus: number; // 默认显示存证
  depositCertificate: {
    base_id: number;
    base_hash: string;
  };
  syMessageBoxConfig: {
    visible: boolean;
    tip: string;
    hightWords?: string;
    handleConfirm: () => any;
    handleCancel?: () => any;
  };
  listOfInformation: any[];
  page: number;
  existingEvidenceList: any[];
  userInfos: any;
  templateNum: number; //模板数量
  theAnchor: number;
  chainStatus: string;
  templateType: number; // 0 系统模板 1 个人模板
  templateData: any;
  currentRoute: number;
  urlList: {
    chain_browser_url: string;
  }; // 跳转链接配置
};

export const globalState = reactive<iGlobalState>({
  businessType: 0, //0设置  1忘记
  goodsNum: 0, // 存证数量
  deletedNum: 0, // 回收站数据总量
  selectedStatus: 0, // 默认显示存证
  depositCertificate: {
    base_id: 0,
    base_hash: "",
  },
  syMessageBoxConfig: {
    visible: false,
    tip: "",
    hightWords: undefined,
    handleConfirm: () => {},
    handleCancel: (() => {}) as (() => void) | undefined,
  },
  listOfInformation: [] as any[],
  page: 1,
  existingEvidenceList: [] as any[],
  userInfos: {} as any,
  templateNum: 0, //模板数量
  theAnchor: -1,
  chainStatus: "",
  templateType: 0, // 0 系统模板 1 个人模板
  templateData: {},
  currentRoute: Number(sessionStorage.getItem("currentRoute")) || 0,
  urlList: {
    chain_browser_url: "",
  }, // 跳转链接配置
});
