import { usePisellOS } from "../../../../hooks/useEngineContext";
import { useOsKey } from "../../context/OsKeyContext";
import { getShopDiscountKey } from "../../utils";

/**
 * useShopDiscountModule Hook
 * 获取当前 ShopDiscount 模块
 * 通过 osKey 区分不同页面的模块实例
 */
export var useShopDiscountModule = function useShopDiscountModule() {
  var pisellOS = usePisellOS();
  var osKey = useOsKey();

  // 根据 osKey 生成模块名称
  var moduleKey = getShopDiscountKey(osKey || 'ticket');
  return pisellOS.getModule(moduleKey);
};