package com.red.circle.console.infra.enums.sys;

import com.red.circle.tool.core.text.StringUtils;
import java.util.Arrays;
import java.util.Objects;

/**
 * 系统礼物类型枚举
 *
 * @author houyong on 2021/1/12
 */
public enum SysGiftTypeEnum {

  /**
   * 免费.
   */
  FREE("FREE", "免费"),
  /**
   * 金币.
   */
  GOLD("GOLD", "金币"),
  /**
   * 钻石.
   */
  DIAMOND("DIAMOND", "钻石");

  private final String desc;
  private final String name;

  SysGiftTypeEnum(String name, String desc) {
    this.name = name;
    this.desc = desc;
  }

  public static String getDescValue(String name) {
    return Arrays.stream(SysGiftTypeEnum.values())
        .filter(sysGiftTypeEnum -> Objects.equals(sysGiftTypeEnum.getName(), name))
        .findFirst()
        .map(SysGiftTypeEnum::getDesc)
        .orElse(StringUtils.UNKNOWN);
  }

  public String getDesc() {
    return desc;
  }

  public String getName() {
    return name;
  }
}
