package com.red.circle.other.domain.redpacket;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 用户红包状态
 */
@Getter
@AllArgsConstructor
public enum UserRedPacketStatus {

    /**
     * 待领取
     */
    PENDING(1, "Pending"),

    /**
     * 已领取
     */
    GRABBED(2, "Grabbed"),

    /**
     * 已过期
     */
    EXPIRED(3, "Expired");

    private final Integer code;
    private final String desc;

    public static UserRedPacketStatus of(Integer code) {
        for (UserRedPacketStatus status : values()) {
            if (status.getCode().equals(code)) {
                return status;
            }
        }
        return null;
    }
}
