package com.lesingle.creation.common.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 报名状态枚举
 */
@Getter
@AllArgsConstructor
public enum RegistrationStateEnum {

    PENDING("pending", "待审核"),
    PASSED("passed", "已通过"),
    REJECTED("rejected", "已拒绝"),
    WITHDRAWN("withdrawn", "已撤回");

    private final String code;
    private final String desc;

    public static RegistrationStateEnum getByCode(String code) {
        if (code == null) {
            return PENDING;
        }
        for (RegistrationStateEnum state : values()) {
            if (state.getCode().equals(code)) {
                return state;
            }
        }
        return PENDING;
    }
}
