/**
 * 演练会签通用hook
 */
import { ref } from 'vue';
import type { SysDictDataDetail } from '@/api/dict';
import { queryDictTypeDetail } from '@/api/dict';
import { DICT_CODE } from '@/constant/dict';

export const useEmergencyDrillHook = () => {
  const drillScopeDice = ref<SysDictDataDetail[]>([]);
  const getDrillScopeDict = async () => {
    const res = await queryDictTypeDetail(DICT_CODE.DRILL_SIGN_TYPE);
    drillScopeDice.value = res.sysDictDataList;
  };
  const getDrillScope = (drillScope: string) => {
    return drillScopeDice.value.find((item) => item.itemCode === drillScope)?.itemValue;
  };
  return {
    drillScopeDice,
    getDrillScopeDict,
    getDrillScope,
  };
};
