package com.lesingle.creation.common.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 竞赛进度状态枚举
 */
@Getter
@AllArgsConstructor
public enum ContestStatusEnum {

    ONGOING("ongoing", "进行中"),
    FINISHED("finished", "已完结");

    private final String code;
    private final String desc;

    public static ContestStatusEnum getByCode(String code) {
        if (code == null) {
            return ONGOING;
        }
        for (ContestStatusEnum status : values()) {
            if (status.getCode().equals(code)) {
                return status;
            }
        }
        return ONGOING;
    }
}
