package com.red.circle.wallet.domain.wallet;

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

/**
 * 钱包业务类型.
 *
 * @author pengliang on 2023/7/2
 */
public enum WalletBizType {
  /**
   * 金币.
   */
  GOLD(1),

  /**
   * 钻石.
   */
  DIAMOND(2),

  /**
   * 豆子.
   */
  BEAN(3),

  /**
   * 游戏券.
   */
  GAME_COUPON(4);

  private final int type;

  WalletBizType(int type) {
    this.type = type;
  }

  public int getType() {
    return type;
  }

  public static WalletBizType toEnum(int type) {
    return Arrays.stream(WalletBizType.values())
        .filter(bizType -> Objects.equals(bizType.type, type))
        .findFirst()
        .orElse(null);
  }

}
