package com.yuchen.saas.park.api.enums.property;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Objects;

/**
 * @Author: caiwq
 * @Date: 2023/11/29 15:18
 * @Description: 职位枚举类型
 */
@Getter
@AllArgsConstructor
public enum PositionEnum {
    /**
     * 主任
     */
    DIRECTOR(1, "主任"),
    /**
     * 副主任
     */
    DEPUTY_DIRECTOR(2, "副主任"),
    /**
     * 成员
     */
    MEMBER(3, "成员");

    private final int value;
    private final String desc;

    public static String getDescByCode(Integer value) {
        if (Objects.isNull(value)) {
            return "";
        }
        PositionEnum[] enumArray = PositionEnum.values();
        for (PositionEnum e : enumArray) {
            if (e.getValue() == value) {
                return e.getDesc();
            }
        }
        return "";
    }
}
