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"
  },
  //判断 status 操作单状态
  scanProduce: {
    OP: "factory/podOrderOperation/scan-produce"
  },
  checkInventory: {
    OP: "factory/podOrderOperation/check-inventory"
  },
  //烫画
  //获取生产配置
  productionConfig: "api/factory/production-config",
  //更新生产配置
  productionConfigUpdate: "/api/factory/production-config/update",
  //排版列表（分页）
  productionSoftware:
    "/api/factory/podOrderBatchDownload/page-production-software",
  //查询该批次下的所有素材
  listMaterialsByBatch:
    "/api/factory/podOrderBatchDownload/list-materials-by-batch",
  //重新合成排版
  psReComposingDesignImages:
    "/api/factory/podOrderBatchDownload/psReComposingDesignImages",
  //根据批次分页查询操作单
  listOperationByBatch:
    "/api/factory/podOrderBatchDownload/listOperationByBatch"
};
// 操作单状态枚举
export const statusMap = {
  待排单: "PENDING_SCHEDULE",
  待拣胚: "PENDING_PICK",
  待补胚: "PENDING_REPLENISH",
  生产中: "IN_PRODUCTION",
  待配货: "PENDING_PACKING",
  配货完成: "PACKING_COMPLETED",
  已完成: "COMPLETED",
  已取消: "CANCELLED",
  已归档: "ARCHIVE"
};

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