package com.njcn.gather.report.pojo.enums;

import lombok.Getter;

/**
 * 统计文档锚点类型
 *
 * @author hongawen
 * @version 1.0
 * @data 2025/3/24 18:42
 */
@Getter
public enum DocAnchorEnum {


    DATA_LINE("#{data:line}", "准确度数据展示区域，以测试回路维度展示", 1),
    DATA_SCRIPT("#{data:script}", "准确度数据展示区域，以检测项维度展示", 1),
    TEST_RESULT_DEV("#{testResult:dev}", "检测结论，仅有设备结论", 2),
    TEST_RESULT_LINE("#{testResult:line}", "检测结论，仅有回路结论", 2),
    TEST_RESULT_DETAIL("#{testResult:detail}", "检测结论，包含回路、设备结论", 2),
    CATALOG("#{catalog}", "目录信息", 3);

    private String key;

    private String desc;

    private Integer sort;

    DocAnchorEnum(String key, String desc, Integer sort) {
        this.key = key;
        this.desc = desc;
        this.sort = sort;
    }

    /**
     * 根据key找到适配的枚举
     *
     * @param key 枚举的key
     * @return 匹配的枚举实例，如果没有找到则返回null
     */
    public static DocAnchorEnum getByKey(String key) {
        for (DocAnchorEnum docAnchorEnum : DocAnchorEnum.values()) {
            if (docAnchorEnum.getKey().equalsIgnoreCase(key)) {
                return docAnchorEnum;
            }
        }
        return null;
    }

}
