package com.bonus.core.allocation.flow.enums;

import com.google.common.collect.Maps;
import org.apache.commons.compress.utils.Lists;

import java.util.*;

public enum FlowDefinitionEum {
   RECHARGING("RECHARGING", "充值审核"),
   DRP_CHECK_INVENTORY("DRP_CHECK_INVENTORY", "出入库盘点审批"),
   DRP_PUR_PLAN("DRP_PUR_PLAN", "采购计划审批"),
   GOODS_ALLOCATION("GOODS_ALLOCATION", "货品调拨审批"),
   DRP_PRODUCTION_PLAN_PLAN("DRP_PRODUCTION_PLAN_PLAN", "菜品生产计划审批"),
   PUR_ORDER_GOODS("PUR_ORDER_GOODS", "采购订单审批"),
   MATERIAL_TENDER_APPROVAL("MATERIAL_TENDER_APPROVAL", "货品招标审批"),
   MATERIAL_COMMODITY_APPROVAL("MATERIAL_COMMODITY_APPROVAL", "商品生产计划审批"),
   FETCH_MATERIAL_APPROVAL("FETCH_MATERIAL_APPROVAL", "领料审批"),
   ROOM_RESERVE("ROOM_RESERVE", "包间预定"),
   ORDER_REFUND("ORDER_REFUND", "订单退款"),
   ACC_WITHDRAW("ACC_WITHDRAW", "提现审批"),
   PORCUREMENT_CONTRACT("PORCUREMENT_CONTRACT", "采购合同审批"),
   ADJUSTMENT_ORDER("ADJUSTMENT_ORDER", "合同调价审批"),
   DRP_SUPPLIER_EDIT("DRP_SUPPLIER_EDIT", "供应商信息修改审批"),
   VISITOR_RESERVATION("VISITOR_RESERVATION", "访客预约", FlowHolderEnum.getVisitorReservation());

   private final String desc;
   private final String type;
   private final List<FlowHolderEnum> value;

   private FlowDefinitionEum(String type, String desc) {
      this.desc = desc;
      this.type = type;
      this.value = Lists.newArrayList();
   }

   private FlowDefinitionEum(String type, String desc, List value) {
      this.desc = desc;
      this.type = type;
      this.value = value;
   }

   public static FlowDefinitionEum getEnumByType(String type) {
      FlowDefinitionEum[] var1 = values();
      int var2 = var1.length;

      for(int var3 = 0; var3 < var2; ++var3) {
         FlowDefinitionEum temp = var1[var3];
         if (temp.getType().equals(type)) {
            return temp;
         }
      }

      return null;
   }

   public static String getDescByType(String type) {
      FlowDefinitionEum enumByType = getEnumByType(type);
      return enumByType == null ? null : enumByType.getDesc();
   }

   public static List<FlowDefinitionEum> getStagingDefinitions() {
      return Arrays.asList(DRP_CHECK_INVENTORY, DRP_PUR_PLAN, GOODS_ALLOCATION, DRP_PRODUCTION_PLAN_PLAN, PUR_ORDER_GOODS, MATERIAL_TENDER_APPROVAL, MATERIAL_COMMODITY_APPROVAL, FETCH_MATERIAL_APPROVAL, PORCUREMENT_CONTRACT, ADJUSTMENT_ORDER, DRP_SUPPLIER_EDIT);
   }

   public static Set<String> getStagingDefinitionsSet() {
      Set<String> set = new HashSet();
      Iterator var1 = getStagingDefinitions().iterator();

      while(var1.hasNext()) {
         FlowDefinitionEum flowDefinitionEum = (FlowDefinitionEum)var1.next();
         set.add(flowDefinitionEum.getType());
      }

      return set;
   }

   public static Map<String, String> getStagingDefinitionsMap() {
      Map<String, String> map = Maps.newHashMap();
      Iterator var1 = getStagingDefinitions().iterator();

      while(var1.hasNext()) {
         FlowDefinitionEum flow = (FlowDefinitionEum)var1.next();
         map.put(flow.type, flow.desc);
      }

      return map;
   }

   public static List<FlowDefinitionEum> getStagingDefinitionsByEnum(FlowDefinitionEum flowDefinitionEum) {
      return Collections.singletonList(flowDefinitionEum);
   }

   public String getDesc() {
      return this.desc;
   }

   public String getType() {
      return this.type;
   }

   public List<FlowHolderEnum> getValue() {
      return this.value;
   }

}
