import type { statusType } from "@/api/order/order";
export const statusOptions: statusOptions[] = [
  { label: "全部", value: "" },
  { label: "待支付", value: "unpaid" },
  { label: "制作中", value: "in-production" },
  { label: "待取餐", value: "wait-out" },
  { label: "订单完成", value: "done" },
  { label: "申请退单", value: "refunding" },
  { label: "退单", value: "refund" },
  { label: "部分退单", value: "part-refund" },
  { label: "取消订单", value: "cancelled" },
];
export const payTypeOptions: payTypeOptions[] = [
  { label: "全部", value: "" },
  {
    label: "现金",
    value: "cash",
  },
  {
    label: "银行卡",
    value: "bank",
  },
  {
    label: "扫码支付",
    value: "scanCode",
  },
  {
    label: "储值卡",
    value: "deposit",
  },
  {
    label: "会员支付",
    value: "vipPay",
  },
  {
    label: "挂账",
    value: "arrears",
  },
];
export const options: { [key in optionsType]: options[] } = {
  status: statusOptions,
  payType: payTypeOptions,
  platformType: [
    { label: '微信小程序', value: 'wechat' },
    { label: '网页后台管理端', value: 'WEB' },
  ],
  sendType: [
    { label: '快递', value: 'post' },
    { label: '外卖', value: 'takeaway' },
    { label: '自提', value: 'takeself' },
    { label: '堂食', value: 'table' },
  ],
  dineMode: [
    { label: '堂食', value: 'dine-in' },
    { label: '外带', value: 'take-out' },
    { label: '外卖', value: 'take-away' },

  ]
}
export type optionsType = string;

export function returnOptions(type: optionsType) {
  return options[type];
}

export function returnOptionsLabel(optionsType: optionsType, value: string | number) {
  const options = returnOptions(optionsType);
  if (!options) {
    return "";
  }
  const option = options.find((item) => item.value === value);
  return option ? option.label : "";
}


export interface options {
  label: string;
  value: string | number;
  [property: string]: any;
}
export interface statusOptions extends options {
  value: statusType;
}

export type payTypeValue =
  | ""
  | "cash"
  | "bank"
  | "scanCode"
  | "deposit"
  | "vipPay"
  | "arrears"
  | "virtual"
  | "arrears";

export interface payTypeOptions extends options {
  value: payTypeValue;
}
