import {useCheckTypeStore} from "@/store/modules/checkType";

const checkTypeStore = useCheckTypeStore();

export const getCheckTypeName = (checkType) => checkTypeStore.getCheckTypeName(checkType)

export const getCheckTypeSeqPrefix = (checkType) => checkTypeStore.getCheckTypeSeqPrefix(checkType)


export const needAutoFeeConfirm = (checkType: number | null | undefined) => {
  if (checkType == null)
    return false

  return checkTypeStore.getExpenseRecognition(checkType)
}

/**
 * 该检查项目是否需要「设备领用」。
 *
 * 配置来源：`check_type.need_dev_ready`（检查类型管理页的「需要设备领用」开关）。
 * 用于「设备领用」页拦截不属于本流程的患者 —— 例如常规心电图(needDevReady=0)
 * 被误拉到领用页时提示并阻断，避免"检查类患者出现在设备领用模块"。
 */
export const needDevReady = (checkType: number | null | undefined) => {
  if (checkType == null)
    return false

  return checkTypeStore.getNeedDevReady(checkType) === 1
}

