package com.lesingle.creation.common.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 竞赛类型枚举
 */
@Getter
@AllArgsConstructor
public enum ContestTypeEnum {

    INDIVIDUAL("individual", "个人赛"),
    TEAM("team", "团队赛");

    private final String code;
    private final String desc;

    public static ContestTypeEnum getByCode(String code) {
        if (code == null) {
            return INDIVIDUAL;
        }
        for (ContestTypeEnum type : values()) {
            if (type.getCode().equals(code)) {
                return type;
            }
        }
        return INDIVIDUAL;
    }
}
