package cn.iocoder.lyzsys.module.tjt.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;

/**
 * 项目/专业分配专业编码枚举。
 */
@Getter
@AllArgsConstructor
public enum OutputSplitSpecialtyEnum {

    PROJECT_LEAD("project_lead", "项目经理/工程负责人", 0, true),
    ARCH("arch", "建筑", 1, false),
    DECOR("decor", "装饰", 2, false),
    STRUCT("struct", "结构", 3, false),
    WATER("water", "给排水", 4, false),
    ELEC("elec", "电气", 5, false),
    HVAC("hvac", "暖通", 6, false),
    DIGITAL("digital", "数字化设计", 7, false);

    private final String code;
    private final String label;
    private final Integer sortNo;
    private final boolean projectLead;

    public static OutputSplitSpecialtyEnum of(String code) {
        return Arrays.stream(values())
                .filter(item -> item.getCode().equals(code))
                .findFirst()
                .orElse(null);
    }

    public static boolean contains(String code) {
        return of(code) != null;
    }

    public static String labelOf(String code) {
        OutputSplitSpecialtyEnum item = of(code);
        return item == null ? code : item.getLabel();
    }

}
