export const pathMap = {
  findByPodProductionNo: {
    CN: "factory/podJomallOrderProductCn/getProductCnByFactorySubOrderNumber",
    US: "factory/podJomallOrderProductUs/getProductUsByFactorySubOrderNumber",
    GC: "factory/podJomallOrderProduct/getSubOrderByThirdSubOrderNumber",
  },
  downloadBySubOrderNumber: {
    CN: "factory/podJomallOrderProductCn/downloadDesignImages",
    US: "factory/podJomallOrderProductUs/downloadDesignImages",
    GC: "factory/podJomallOrder/downloadByProduction",
    USHLC: "factory/podJomallOrderProductUs/downloadCompatibleDesignImages",
    CNHLC: "factory/podJomallOrderProductCn/downloadCompatibleDesignImages",
  },
  completeDelivery: {
    CN: "factory/podJomallOrderProductCn/completeDelivery",
    US: "factory/podJomallOrderProductUs/completeDelivery",
    GC: "factory/podJomallOrderProduct/completeDelivery",
  },
};

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