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

import com.alibaba.fastjson.annotation.JSONField;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;

/**
 * @author wr
 * @description
 * @date 2024/12/18 9:09
 */
@NoArgsConstructor
@Data
public class DevData {

    @JSONField(name = "Time", ordinal = 1)
    private String time;

    /**
     * 设备ip_通道号 这种形式
     */
    @JSONField(name = "ID", ordinal = 2)
    private String id;

    @JSONField(name = "result", ordinal = 3)
    private Boolean result;

    @JSONField(name = "SqlData", ordinal = 4)
    private List<SqlDataDTO> sqlData;

    @JSONField(name = "SqlDataHarm", ordinal = 5)
    private List<SqlDataHarmDTO> sqlDataHarm;

    @JSONField(name = "SlowValueTimeList", ordinal = 6)
    private List<SlowValueTimeDTO> slowValueTimeList;

    @NoArgsConstructor
    @Data
    public static class SqlDataDTO {
        //类型 平均值 最大值 最小值 CP95值 实时值
        @JSONField(name = "type", ordinal = 1)
        private String type;
        //指标 电流有效值
        @JSONField(name = "desc", ordinal = 2)
        private String desc;
        @JSONField(name = "list", ordinal = 3)
        private ListDTO list;

        @NoArgsConstructor
        @Data
        public static class ListDTO {
            @JSONField(name = "A", ordinal = 1)
            private Double a;
            @JSONField(name = "B", ordinal = 2)
            private Double b;
            @JSONField(name = "C", ordinal = 3)
            private Double c;
            @JSONField(name = "T", ordinal = 4)
            private Double t;
        }
    }

    @NoArgsConstructor
    @Data
    public static class SqlDataHarmDTO {
        @JSONField(name = "type", ordinal = 1)
        private String type;
        @JSONField(name = "desc", ordinal = 2)
        private String desc;
        @JSONField(name = "num", ordinal = 3)
        private Integer num;
        @JSONField(name = "list", ordinal = 4)
        private ListDTO list;

        @NoArgsConstructor
        @Data
        public static class ListDTO {
            @JSONField(name = "A", ordinal = 1)
            private List<String> a;
            @JSONField(name = "B", ordinal = 2)
            private List<String> b;
            @JSONField(name = "C", ordinal = 3)
            private List<String> c;
        }
    }

    @NoArgsConstructor
    @Data
    public static class SlowValueTimeDTO {
        @JSONField(name = "type", ordinal = 1)
        private String type; // 类似于 real、avg 、max、min、cp95

        @JSONField(name = "desc", ordinal = 2)
        private String desc; // 类似于 FREQ、PST、IRMS、VRMS等指标项

        @JSONField(name = "list", ordinal = 3)
        private ListDTO list;

        @NoArgsConstructor
        @Data
        public static class ListDTO {
            @JSONField(name = "A", ordinal = 1)
            private String a; // 表示时间 "2026-07-15T08:42:54.705"
            @JSONField(name = "B", ordinal = 2)
            private String b;
            @JSONField(name = "C", ordinal = 3)
            private String c;
            @JSONField(name = "T", ordinal = 4)
            private String t;
        }
    }
}
