export const pathMap = {
  //查询接口
  findByPodProductionNo: "factory/podOrderOperation/getByOperationNo",
  //下载素材接口
  downloadBySubOrderNumber: {
    XD: "factory/podOrderOperation/downloadDesignImages",
    HLC: "factory/podOrderOperation/downloadCompatibleDesignImages",
  },
  //生产完成接口
  completeDelivery: "factory/podOrderOperation/printerCompleteDelivery",
};

export function autoRegisterRouter(router, funcKey, handler) {
  const config = pathMap[funcKey];
  const pathList =
    typeof config === "string" ? [config] : Object.values(config);
  // 遍历配置自动注册路由
  pathList.forEach((path) => {
    // 拼接完整路径（兼容首尾斜杠）
    const fullPath = `/${path.replace(/^\//, "")}`;
    router.post(fullPath, handler);
  });
}
