import { globalState } from "./state";

export const updateBusinessType = (type: any) => {
  globalState.businessType = type;
};
// 设置存证数量
export const setGoodsNum = (num: number) => {
  globalState.goodsNum = num;
};
// 回收站数据总量
export const setDeletedNum = (num: number) => {
  globalState.deletedNum = num;
};
// 右侧展示
export const setSelectedStatus = (num: number) => {
  globalState.selectedStatus = num;
};
// 设置初始存证基础数据
export const setDepositCertificate = (val: any) => {
  globalState.depositCertificate.base_id = val.item.id;
  globalState.depositCertificate.base_hash = val.item.hash;
};
// 设置存证数据列表
export const setListOfInformation = (val: any) => {
  globalState.listOfInformation = val;
};
// 更改页码
export const setPage = (page: number) => {
  globalState.page = page;
};

export const setIncrementList = (val: any) => {
  globalState.listOfInformation[val.index].incrementList = val.list;
};
// 设置增量数据列表
export const setExistingEvidenceList = (val: any) => {
  globalState.existingEvidenceList = val;
};
export const setuserInfos = (infos: any) => {
  globalState.userInfos = infos;
};
// 设置模板数量
export const setTemplateNum = (num: number) => {
  globalState.templateNum = num;
};
export const setTheAnchor = (num: number) => {
  globalState.theAnchor = num;
};
export const setChainStatus = (str: string) => {
  globalState.chainStatus = str;
};
export const setTemplateType = (num: number) => {
  globalState.templateType = num;
};
export const setTemplateData = (data: any) => {
  globalState.templateData = data;
};
export const setCurrentRoute = (currentRoute: any) => {
  globalState.currentRoute = currentRoute;
};
export const setUrlList = (urlList: any) => {
  if (import.meta.env.VITE_CHAIN_URL) {
    globalState.urlList = {
      ...urlList,
      chain_browser_url: import.meta.env.VITE_CHAIN_URL,
    };
  } else {
    globalState.urlList = urlList;
  }
};
