package org.dromara.project.domain.enums;

import lombok.Getter;
import org.dromara.common.core.utils.ObjectUtils;

/**
 * 项目成员岗位枚举
 *
 * @author lcj
 * @date 2025/3/21 13:36
 */
@Getter
public enum ProjectTeamMemberPostEnum {

    MEMBER("普通成员", "0"),
    FOREMAN("班组长", "1");

    private final String text;

    private final String value;

    ProjectTeamMemberPostEnum(String text, String value) {
        this.text = text;
        this.value = value;
    }

    /**
     * 根据 value 获取枚举
     *
     * @param value 项目成员岗位枚举值
     * @return 项目成员岗位枚举
     */
    public static ProjectTeamMemberPostEnum getEnumByValue(String value) {
        if (ObjectUtils.isEmpty(value)) {
            return null;
        }
        for (ProjectTeamMemberPostEnum anEnum : ProjectTeamMemberPostEnum.values()) {
            if (anEnum.value.equals(value)) {
                return anEnum;
            }
        }
        return null;
    }

}
