package com.tofly.xrtymis.em;

import lombok.AllArgsConstructor;
import lombok.Getter;
import org.springframework.util.StringUtils;

/**
 * @ClassName: ExcelExportFileTypeEnum
 * @Description: 导出文件枚举
 * @Author Zev
 * @Date 2021/3/25
 * @Version 1.0.0
 */
@Getter
@AllArgsConstructor
public enum ExcelExportFileTypeEnum {
    /**
     *
     */
    EXPORT_PIPE("/管线采集信息.xlsx","管线采集","exportPipeService","1"),
    EXPORT_METER("/水表采集信息.xlsx","水表采集","exportMeterService","1"),
    EXPORT_STATION("/监测站采集信息.xlsx","监测站采集","exportStationService","1"),
    EXPORT_VALVE("/阀门采集信息.xlsx","阀门采集","exportValveService","1"),
    EXPORT_NOVALVE("/非控制阀采集信息.xlsx","非控制阀采集","exportNoValveService","1"),
    EXPORT_HYDRANT("/消防栓采集信息.xlsx","消防栓采集","exportHydrantService","1"),
    EXPORT_MANHOLE("/检查井采集信息.xlsx","检查井采集","exportManholeService","1"),
    EXPORT_NODE("/管点采集信息.xlsx","管点采集","exportNodeService","1"),
    EXPORT_PIP_NODE("/管点采集信息.xlsx","管点采集","exportPipeToNodeService","1"),
    EXPORT_GDGLINFO("/工单信息.xlsx","工单","exportGdglService","1"),
    //没有创建以下 gdPercent 的service；这里目的只是用来获取文件名，方便查找
    EXPORT_GD_PERCENT("/工单完成率详情.xlsx","完成率统计","exportGdOverRateService","1"),
    EXPORT_DEPT_GD_PERCENT("/工单完成率部门统计详情.xlsx","完成率部门统计","exportDeptGdOverRateService","1"),
    EXPORT_GD_PERCENT_DETAILS("/工单完成率细分详情.xlsx","完成率细分统计","exportGdOverDetailsRateService","1"),
    EXPORT_GD_ABNORMAL("/工单异常率详情.xlsx","异常率统计","exportGdAbnormalRateService","1"),
    EXPORT_DEPT_GD_ABNORMAL("/工单异常率部门统计详情.xlsx","异常率部门统计","exportDeptGdAbnormalRateService","1"),
    EXPORT_GD_ABNORMAL_DETAILS("/工单异常率细分详情.xlsx","异常率细分统计","exportGdAbnormalDetailsRateService","1"),
    ;
    /**
     * 导出模板文件
     */
    private String templateFile;
    /**
     * 导出表格名
     */
    private String sheetName;

    /**
     * 模板服务类型
     */
    private String templateServiceType;

    /**
     * 是否为示例模板
     */
    private String flag;

    /**
     * 根据模型类型和是否为示例模板获取对应枚举对象
     *
     * @param templateServiceType 模型类型
     * @param flag                是否为示例模板
     * @return 枚举对象
     */
    public static ExcelExportFileTypeEnum getExcelExportFileTypeEnum(String templateServiceType, String flag) {
        if (StringUtils.isEmpty(templateServiceType)) {
            return null;
        }

        for (ExcelExportFileTypeEnum e : ExcelExportFileTypeEnum.values()) {
            if (e.templateServiceType.equalsIgnoreCase(templateServiceType) && e.flag.equalsIgnoreCase(flag)) {
                return e;
            }
        }
        return null;
    }
}
