package com.lesingle.creation.common.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 报名任务状态枚举
 */
@Getter
@AllArgsConstructor
public enum RegisterTaskStateEnum {

    STARTED("started", "已开始"),
    CLOSED("closed", "已截止");

    private final String code;
    private final String desc;

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