export const pathMap = {
  //查询接口
  findByPodProductionNo: {
    CN: "factory/podJomallOrderProductCn/getProductCnByFactorySubOrderNumber",
    US: "factory/podJomallOrderProductUs/getProductUsByFactorySubOrderNumber",
    GC: "factory/podJomallOrderProduct/getSubOrderByThirdSubOrderNumber",
    OP: "factory/podOrderOperation/getByOperationNo",
  },
  //下载素材接口
  downloadBySubOrderNumber: {
    CN: "factory/podJomallOrderProductCn/downloadDesignImages",
    US: "factory/podJomallOrderProductUs/downloadDesignImages",
    GC: "factory/podJomallOrder/downloadByProduction",
    OP: "factory/podOrderOperation/downloadDesignImages",
    USHLC: "factory/podJomallOrderProductUs/downloadCompatibleDesignImages",
    CNHLC: "factory/podJomallOrderProductCn/downloadCompatibleDesignImages",
    OPHLC: "factory/podOrderOperation/downloadCompatibleDesignImages",
  },
  //生产完成接口
  completeDelivery: {
    CN: "factory/podJomallOrderProductCn/completeDelivery",
    US: "factory/podJomallOrderProductUs/completeDelivery",
    GC: "factory/podJomallOrderProduct/completeDelivery",
    OP: "factory/podOrderOperation/printerCompleteDelivery",
  },
  //惠立彩素材下载接口
  processTransparentBackground: {
    CN: "factory/podJomallOrderProductCn/processTransparentBackground",
    US: "factory/podJomallOrderProductUs/processTransparentBackground",
  },
};

export function autoRegisterRouter(router, funcKey, handler) {
  const configGroup = pathMap[funcKey];
  // 遍历配置自动注册路由
  Object.values(configGroup).forEach((el) => {
    router.post(`/${el}`, (req, res) => {
      handler(req, res);
    });
  });
}
