package com.bonus.canteen.core.notice.print.v2.constant;

import cn.hutool.core.util.ObjectUtil;
import com.bonus.canteen.core.device.constants.PrinterModelEnum;

public enum PrinterDeviceTypeEnum {
   TICKET_PRINTER(1, "notice_printer_device_ticket"),
   LABEL_PRINTER(2, "notice_printer_device_label");

   private final Integer key;
   private final String i18n;

   private PrinterDeviceTypeEnum(Integer key, String i18n) {
      this.key = key;
      this.i18n = i18n;
   }

   public static String getI18n(Integer key) {
      PrinterDeviceTypeEnum[] var1 = values();
      int var2 = var1.length;

      for(int var3 = 0; var3 < var2; ++var3) {
         PrinterDeviceTypeEnum temp = var1[var3];
         if (temp.getKey().equals(key)) {
            return temp.getI18n();
         }
      }

      return "";
   }

   public static PrinterDeviceTypeEnum getPrinterDeviceType(String printerModel) {
      PrinterModelEnum printerModelEnum = PrinterModelEnum.getPrinterModelEnum(printerModel);
      if (ObjectUtil.isNull(printerModelEnum)) {
         return null;
      } else {
         switch (printerModelEnum) {
            case FEI_E:
            case JIA_BO:
               return TICKET_PRINTER;
            case FEI_E_LABEL:
            case JIA_BO_LABEL:
               return LABEL_PRINTER;
            default:
               return null;
         }
      }
   }

   public Integer getKey() {
      return this.key;
   }

   public String getI18n() {
      return this.i18n;
   }

}
