package com.bonus.core.order.common.vo;

import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.ListUtil;
import cn.hutool.core.map.MapUtil;

import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

public class OrderEnumVO {
   private Integer key;
   private String value;

   public static List<OrderEnumVO> listOf(List<Map<String, Object>> allEnumsList) {
      return CollUtil.isEmpty(allEnumsList) ? ListUtil.empty() : (List)allEnumsList.stream().map((map) -> {
         OrderEnumVO orderEnumVO = new OrderEnumVO();
         orderEnumVO.setKey(MapUtil.getInt(map, "key"));
         orderEnumVO.setValue(MapUtil.getStr(map, "value"));
         return orderEnumVO;
      }).collect(Collectors.toList());
   }

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

   public String getValue() {
      return this.value;
   }

   public void setKey(final Integer key) {
      this.key = key;
   }

   public void setValue(final String value) {
      this.value = value;
   }

}
