package com.lesingle.creation.common.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 团队角色枚举
 */
@Getter
@AllArgsConstructor
public enum TeamRoleEnum {

    MEMBER("member", "队员"),
    LEADER("leader", "队长"),
    MENTOR("mentor", "指导老师");

    private final String code;
    private final String desc;

    public static TeamRoleEnum getByCode(String code) {
        if (code == null) {
            return MEMBER;
        }
        for (TeamRoleEnum role : values()) {
            if (role.getCode().equals(code)) {
                return role;
            }
        }
        return MEMBER;
    }
}
