package com.red.circle.other.inner.enums.sys;

import java.util.Arrays;
import java.util.Objects;

/**
 * 徽章类型枚举.
 *
 * @author houyong on 2021/3/19
 */
public enum SysBadgeConfigTypeEnum {

  /**
   * 成就.
   */
  ACHIEVEMENT("ACHIEVEMENT", "用户-成就"),

  /**
   * 管理员.
   */
  ADMINISTRATOR("ADMINISTRATOR", "用户-管理员"),

  /**
   * 活动.
   */
  ACTIVITY("ACTIVITY", "用户-活动"),

    /**
     * 荣誉活动.
     */
  HONOR_ACTIVITY("HONOR_ACTIVITY", "荣誉-活动"),

    /**
     * 荣誉管理员.
     */
  HONOR_ADMIN("HONOR_ADMIN", "荣誉-成就"),

  /**
   * 家族-徽章.
   */
  FAMILY("FAMILY", "家族-徽章"),

  /**
   * 房间成就.
   */
  ROOM_ACHIEVEMENT("ROOM_ACHIEVEMENT", "房间-成就");

    public static boolean isHonorType(String name) {
        return name != null && name.startsWith("HONOR");
    }

  private final String desc;
  private final String name;

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

  public static String getDescValue(String name) {
    return Arrays.stream(SysBadgeConfigTypeEnum.values())
        .filter(sysDictionaryTypeEnum -> Objects.equals(sysDictionaryTypeEnum.getName(), name))
        .findFirst()
        .map(SysBadgeConfigTypeEnum::getDesc)
        .orElse("未知");
  }

  public String getDesc() {
    return desc;
  }

  public String getName() {
    return name;
  }
}
