package com.hdkj.lt.mq.entity;

import java.util.Arrays;
import java.util.Optional;

public enum EvaluationMetric {
    LOSS_USERS("损失户数（户）",true),
    TRANSFER_LOAD_RATIO("转出负荷比例（%）",true),
    OPPSITE_LINE_MAX_LOAD_RATE("对侧线路最大负债率（%）",true),
    NON_AUTO_SWITCH_OPERATION_TIMES("开关序列中非自动化开关个数（个）",false),
    SWITCH_OPERATION_TIMES("开关操作次数（次）",false),
    DISTRIBUTION_TANSFORMER_VOLTAGE("配变低电压（台）",true);


    //指标名称
    private final String name;
    //判断值是否越小越好
    private final boolean lowerIsBetter;
    EvaluationMetric(String name, boolean lowerIsBetter){
        this.name = name;
        this.lowerIsBetter = lowerIsBetter;
    }

    public String getName(){
        return name;
    }

    public boolean isLowerIsBetter(){
        return lowerIsBetter;
    }


    public static Optional<EvaluationMetric> findByName(String name){
        return Arrays.stream(EvaluationMetric.values()).filter(v->v.name.equals(name)).findFirst();
    }


}
