package com.njcn.csreport.enums;

/**
 * Description:
 * Date: 2024/9/12  20:23【需求编号】
 *
 * @author clam
 * @version V1.0.0
 */

import com.baomidou.mybatisplus.extension.service.IService;
import com.njcn.csreport.pojo.po.RStatDataID;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

/**
 * 报表的表映射
 */
public enum ReportTableEnum {
    R_STAT_DATA_V_D("r_stat_data_v_d","RStatDataVD"),
    R_STAT_DATA_I_D("r_stat_data_i_d","RStatDataID"),
    R_STAT_DATA_PLT_D("r_stat_data_plt_d","RStatDataPltD"),
    R_STAT_DATA_FLUC_D("r_stat_data_fluc_d","RStatDataFlucD"),
    R_STAT_DATA_FLICKER_D("r_stat_data_flicker_d","RStatDataFlickerD"),
    R_STAT_DATA_HARMPHASIC_I_D("r_stat_data_harmphasic_i_d","RStatDataHarmphasicID"),
    R_STAT_DATA_HARMPHASIC_V_D("r_stat_data_harmphasic_v_d","RStatDataHarmphasicVD"),
    R_STAT_DATA_HARMPOWER_P_D("r_stat_data_harmpower_p_d","RStatDataHarmpowerPD"),
    R_STAT_DATA_HARMPOWER_Q_D("r_stat_data_harmpower_q_d","RStatDataHarmpowerQD"),
    R_STAT_DATA_HARMPOWER_S_D("r_stat_data_harmpower_s_d","RStatDataHarmpowerSD"),
    R_STAT_DATA_HARMRATE_I_D("r_stat_data_harmrate_i_d","RStatDataInharmID"),
    R_STAT_DATA_HARMRATE_V_D("r_stat_data_harmrate_v_d","RStatDataInharmVD"),
    R_STAT_DATA_INHARM_I_D("r_stat_data_inharm_i_d","RStatDataHarmrateID"),
    R_STAT_DATA_INHARM_V_D("r_stat_data_inharm_v_d","RStatDataHarmrateVD");




    private final String tableName;
    private final String entityName;



    ReportTableEnum(String tableName, String entityName) {
        this.tableName = tableName;
        this.entityName = entityName;
    }

    /**
     * 获取所有可执行的组件类型，
     * 除了"目录"类型，其他都可以执行
     * @return
     */
    public static List<String> getExecutableTypes() {
        return Arrays.stream(ReportTableEnum.values()).map(tmep->{
            return tmep.tableName;
        }).collect(Collectors.toList());
    }


    /**
     * 通过TableName获取Influxdb实体类
     * @param tableName
     * @return
     */
    public static String getEntityName(String tableName) {
        for (ReportTableEnum item : ReportTableEnum.values()) {
            if (item.tableName.equals(tableName)) {
                return item.entityName;
            }
        }
        return null;
    }


}
