package com.cmvr.common.enums;

import lombok.Getter;

@Getter
public enum GroupType {
    DETECTION(1, "检测项"),
    TASK(2, "任务"),
    DEVICE(3, "设备");

    private final int code;
    private final String description;

    GroupType(int code, String description) {
        this.code = code;
        this.description = description;
    }

    public static GroupType fromCode(int code) {
        for (GroupType type : GroupType.values()) {
            if (type.getCode() == code) {
                return type;
            }
        }
        throw new IllegalArgumentException("Unknown code: " + code);
    }
}