const madeSteps = [
  {
    value: 1,
    title: "步骤 1/{}: 车辆信息",
  },
  {
    value: 2,
    title: "步骤 2/{}: 瓜农信息",
  },
  {
    value: 3,
    title: "步骤 3/{}: 重量信息",
  },
  {
    value: 4,
    title: "步骤 4/{}: 包装信息",
  },
  {
    value: 5,
    title: "步骤 5/{}: 票证上传",
  },
  {
    value: 6,
    title: "步骤 6/{}: 人工和辅料信息",
  },
  {
    value: 7,
    title: "信息确认",
  },
];

const marketSteps = [
  {
    value: 1,
    title: "步骤 1/{}: 车辆信息",
  },
  {
    value: 2,
    title: "步骤 2/{}: 档口信息",
  },
  {
    value: 3,
    title: "步骤 3/{}: 重量信息",
  },
  {
    value: 4,
    title: "步骤 4/{}: 包装信息",
  },
  {
    value: 5,
    title: "信息确认",
  },
];

const path = {
  PRODUCTION_PURCHASE: {
    create: "/pages/purchase/made/create",
    preview: "/pages/purchase/made/preview",
    result: "/pages/purchase/made/result",
    drafts: "/pages/purchase/made/drafts",
  },
  MARKET_PURCHASE: {
    create: "/pages/purchase/market/create",
    preview: "/pages/purchase/market/preview",
    result: "/pages/purchase/market/result",
    drafts: "/pages/purchase/market/drafts",
  },
};

const supplierSlug = {
  PRODUCTION_PURCHASE: "瓜农",
  MARKET_PURCHASE: "档口",
};

const isPreview = (purchaseVO: BusinessAPI.OrderVO) => {
  if (purchaseVO.type === "PRODUCTION_PURCHASE") {
    return purchaseVO.active >= madeSteps.length - 1;
  }

  if (purchaseVO.type === "MARKET_PURCHASE") {
    return purchaseVO.active >= marketSteps.length - 1;
  }

  return false;
};

export default { madeSteps, marketSteps, path, supplierSlug, isPreview };
