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

import cn.hutool.core.util.ObjectUtil;
import lombok.Getter;

/**
 * @Description:
 * @Author: wr
 * @Date: 2024/12/17 15:37
 */
@Getter
public enum SourceOperateCodeEnum {

    /**
     * 源状态
     */
    INIT_GATHER("INIT_GATHER", "源初始化"),
    OPER_GATHER("OPER_GATHER", "源输出"),
    CLOSE_GATHER("CLOSE_GATHER", "源停止"),
    HEARTBEAT("HeartBeat", "心跳报文"),

    /**
     * 终端 INIT_GATHER$01  INIT_GATHER采集初始化，01 统计采集、02 暂态采集、03 实时采集
     */
    DEV_INIT_GATHER_01("INIT_GATHER$01", "统计采集"),
    DEV_INIT_GATHER_02("INIT_GATHER$02", "实时采集"),
    DEV_INIT_GATHER_03("INIT_GATHER$03", "暂态采集"),

    DEV_DATA_REQUEST_01("DATA_REQUEST$01", "统计采集申请"),
    DEV_DATA_REQUEST_02("DATA_REQUEST$02", "实时采集申请"),
    DEV_DATA_REQUEST_03("DATA_REQUEST$03", "暂态采集申请"),

    QUIT_INIT_01("QUIT_FUNEND$01", "关闭统计申请"),
    QUIT_INIT_02("QUIT_FUNEND$02", "关闭实时申请"),
    QUIT_INIT_03("QUIT_FUNEND$03", "关闭暂态申请"),


    DATA_CHNFACTOR$01("DATA_CHNFACTOR$01","校验系数获取"),
    DATA_CHNFACTOR$02("DATA_CHNFACTOR$02","校验系数下发"),

    VERIFY_MAPPING$01("VERIFY_MAPPING$01","脚本与icd校验"),


    /**
     * 请求操作类型对应实体中 requestId
     */
    YJC_YTXJY("yjc_ytxjy", "源通讯检测"),
    YJC_SBTXJY("yjc_sbtxjy", "设备通讯检测"),
    YJC_XYJY("yjc_xyjy", "协议校验"),
    YJC_XUJY("YJC_xujy", "相序校验"),
    YJC_ALIGN("yjc_align","实时数据对齐校验"),
    YJC_MXYZXJY("yjc_mxyzxjy", "模型一致性校验"),
    FORMAL_REAL("formal_real","正式检测"),
    RECORD_WAVE_STEP1("record_wave_step1","启动录波_step1"),
//    RECORD_WAVE_STEP2("record_wave_step2","启动录波_step2"),
//    SIMULATE_REAL("simulate_real","模拟检测"),
    Coefficient_Check("Coefficient_Check","系数校验"),
    QUITE("quit","关闭设备通讯初始化"),
    QUITE_SOURCE("close_source","关闭源通讯"),
    ERROR_FLOW_END("error_flow_end","当前流程存在异常结束"),
    YXT("yxt","心跳"),
    REPORT_CAT("FTP_SEND$01","处理报告"),

    UNKNOWN_OPERATE("unknown_operate","未知的操作返回,请联系管理员排查"),
    SOCKET_TIMEOUT("socket_timeout","与源或者装置通讯等待超时"),
    STOP_TIMEOUT("stop_timeout","暂停时间超过十分钟"),
    SERVER_ERROR("server_error","服务端主动关闭连接,请稍后再试"),
    DEVICE_ERROR("device_error","设备主动关闭连接,请稍后再试"),

    FLICKER_DATA_CHECK("flicker_data_check","闪变数据校验"),





    /**
     *
     */
//    COEFFICIENT_TEST("0","系数校验"),
//    PRE_TEST("1","预检测"),
//    FORMAL_TEST("2","正式检测"),
//    TIME_TEST("3","守时检测"),
//    PHASE_TEST("4","相序检测"),
//    TEST_TEM_STOP("5","临时停止"),
    ALL_TEST("1","全部检测"),
    RE_ERROR_TEST("2","不合格项复检"),
    SIMULATE_TEST("4","模拟检测"),
    //TEST_STOP("7","停止检测"),
    //FAST_TEST("10","一键检测"),

    /**
     * 系数校验步骤
     */
    big_start("big_start","大电压系数下装开始"),
    big_end("big_end","大电压系数下装结束"),
    small_start("small_start","小电压系数下装开始"),
    small_end("small_end","小电压系数下装结束"),
    big_comp_start("big_comp_start","大电压校准开始"),
    big_comp_end("big_comp_end","大电压校准结束"),
    small_comp_start("small_comp_start","小电压校准开始"),
    small_comp_end("small_comp_end","小电压校准结束"),


    /**
     * ftp文件传送指令
     */
    FTP_SEND_01("FTP_SEND$01", "发送文件"),
    RDRE$01("RDRE$01", "启动录波");

    private final String value;
    private final String msg;

    SourceOperateCodeEnum(String value, String msg) {
        this.value = value;
        this.msg = msg;
    }

    public static SourceOperateCodeEnum getDictDataEnumByCode(String value) {
        for (SourceOperateCodeEnum sourceOperateCodeEnum : SourceOperateCodeEnum.values()) {
            if (ObjectUtil.equals(value, sourceOperateCodeEnum.getValue())) {
                return sourceOperateCodeEnum;
            }
        }
        return null;
    }
}
