const stateList = [
  {
    title: "全部",
    value: "ALL",
  },
  {
    title: "草稿",
    value: "DRAFT",
  },
  {
    title: "待发货",
    value: "WAIT_SHIPMENT",
  },
  {
    title: "待回款",
    value: "WAIT_PAYMENT",
  },
  {
    title: "部分回款",
    value: "PARTIAL_PAYMENT",
  },
  {
    title: "已回款",
    value: "FULL_PAYMENT",
  },
  {
    title: "拒收完结",
    value: "REJECT_FINISH",
  },
  {
    title: "已完结",
    value: "FINISH",
  },
];

// 定义需求状态映射 - 优化颜色方案
const stateMap = {
  DRAFT: {
    label: "草稿",
    color: "#6B7280",
    bgColor: "#F3F4F6",
    borderColor: "#D1D5DB",
  },
  WAIT_SHIPMENT: {
    label: "待发货",
    color: "#EA580C",
    bgColor: "#FEF3C7",
    borderColor: "#D97706",
  },
  WAIT_PAYMENT: {
    label: "待回款",
    color: "#1E40AF",
    bgColor: "#DBEAFE",
    borderColor: "#3B82F6",
  },
  PARTIAL_PAYMENT: {
    label: "部分回款",
    color: "#7C2D12",
    bgColor: "#FDE68A",
    borderColor: "#F59E0B",
  },
  FULL_PAYMENT: {
    label: "已回款",
    color: "#065F46",
    bgColor: "#A7F3D0",
    borderColor: "#10B981",
  },
  REJECT_FINISH: {
    label: "拒收完结",
    color: "#86198F",
    bgColor: "#F3E8FF",
    borderColor: "#A855F7",
  },
  FINISH: {
    label: "已完结",
    color: "#374151",
    bgColor: "#E5E7EB",
    borderColor: "#6B7280",
  },
};

const steps = [
  {
    value: 1,
    title: "填写信息",
  },
  {
    value: 2,
    title: "预览确认",
  },
  {
    value: 3,
    title: "生成下载",
  },
];

/** 发货单类型：1_采购发货；2_调货发货；3_改签发货；4_退货发货 */
// type?: "PURCHASE_SHIP" | "TRANSFER_SHIP" | "CHANGE_SHIP" | "RETURN_SHIP";
const typeList = [
  {
    label: "采购发货",
    value: "PURCHASE_SHIP",
  },
  {
    label: "调货发货",
    value: "TRANSFER_SHIP",
  },
  {
    label: "改签发货",
    value: "CHANGE_SHIP",
  },
  {
    label: "退货发货",
    value: "RETURN_SHIP",
  },
];

export const getTypeLabel = (type: string) => {
  const typeInfo = typeList.find((item) => item.value === type);
  return typeInfo ? typeInfo.label : "";
};

export const getStateLabel = (state: string) => {
  const stateInfo = stateMap[state];
  return stateInfo ? stateInfo.label : "";
};

export default {
  steps,
  stateList,
  stateMap,
  typeList,
  getTypeLabel,
  getStateLabel,
};
