export const options: optionObject = {
  connectionType: [
    { label: "USB", value: 'USB' },
    { label: "云打印", value: '云打印' },
    { label: "局域网", value: '局域网' },
  ],
  subType: [
    { label: "标签", value: 'label' },
    { label: "小票", value: 'cash' },
    { label: "出品", value: 'kitchen' },
  ],
  contentType: [
    { label: "云想印", value: '云想印' },
    { label: "飞鹅", value: '飞鹅' },
  ],
  receiptSize: [
    { label: "58mm", value: '58mm' },
    { label: "80mm", value: '80mm' },
  ],
  classifyPrint: [
    { label: "所有", value: 0 },
    { label: "部分分类（仅打印制作单[厨房]）", value: 1 },
    // { label: "部分商品", value: 2 },
  ],
  printQty: [
    { label: "顾客+商家[2张] ", value: 'c1m1^2' },
    { label: "商家[1张]", value: 'm1^1' },
    { label: "顾客[1张]", value: 'c1^1' },
    { label: "顾客2+商家1[3张]", value: 'c2m1^3' },
  ],
  printMethod: [
    { value: "all", label: '全部打印' },
    { value: "normal", label: '仅打印结账单「前台」' },
    { value: "one", label: '仅打印制作单「厨房」' },
    { value: "queue", label: '仅打印排队取号' },
  ],
  printType: [
    { label: "确认退款单", value: 'refund' },
    { label: "交班单", value: 'handover' },
    { label: "排队取号", value: 'queue' },
  ]
}

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 optionObject {
  [property: string]: options[];
}