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

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;

/**
 * 合约规划设计阶段枚举。
 */
@Getter
@AllArgsConstructor
public enum ProjectPlanningDesignStageEnum {

    SCHEME("scheme", "方案"),
    CONSTRUCTION_DRAWING("construction_drawing", "施工图"),
    SCHEME_AND_CONSTRUCTION_DRAWING("scheme_and_construction_drawing", "方案+施工图");

    private final String code;
    private final String label;

    public static ProjectPlanningDesignStageEnum 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) {
        ProjectPlanningDesignStageEnum item = of(code);
        return item == null ? code : item.getLabel();
    }

}
