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

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

import java.util.List;

/**
 * @author wr
 * @description
 * @date 2024/12/16 11:24
 */
@NoArgsConstructor
@Data
public class SourceIssue {

    /**
     * 检测小项dtls Id
     */
    @JSONField(serialize = false)
    private String id;

    /**
     * 是否启用
     */
    @JSONField(serialize = false)
    private Integer enable;
    /**
     * 源ID
     */
    @JSONField(name = "sourceId", ordinal = 1)
    private String sourceId;

    /**
     * 检测脚本
     */
    @JSONField(serialize = false)
    private String scriptId;

    /**
     * 总检测下的检测脚本序号
     */
    @JSONField(serialize = false)
    private Integer index;

    /**
     * 装置下发参数
     */
    @JSONField(serialize = false)
    private List<String> devValueTypeList;

    @JSONField(serialize = false)
    private String dataType;


    @JSONField(serialize = false)
    private String desc;


    /**
     * 检测类型
     */
    @JSONField(name = "type", ordinal = 2)
    private String type;

    /**
     * 是否按电压执行
     */
    @JSONField(serialize = false)
    private String otherType;

    /**
     * 多量响量
     */
    @JSONField(name = "subType", ordinal = 3)
    private String subType;

    /**
     * 被检设备额定电压
     */
    @JSONField(name = "fUn", ordinal = 4)
    private Double fUn;

    /**
     * 被检设备额定电流
     */
    @JSONField(name = "fIn", ordinal = 5)
    private Double fIn;

    /**
     * 频率
     */
    @JSONField(name = "fFreq", ordinal = 6)
    private Double fFreq;

    /**
     * 通道信息
     */
    @JSONField(name = "channelList", ordinal = 7)
    private List<ChannelListDTO> channelList;

    @NoArgsConstructor
    @Data
    public static class ChannelListDTO {

        /**
         * 通道使能标志
         */
        @JSONField(name = "channelFlag", ordinal = 1)
        private Boolean channelFlag;

        /**
         * 谐波使能标志
         */
        @JSONField(name = "harmFlag", ordinal = 2)
        private Boolean harmFlag;

        /**
         * 间谐波使能标志
         */
        @JSONField(name = "inHarmFlag", ordinal = 3)
        private Boolean inHarmFlag;

        /**
         * 暂态使能标志
         */
        @JSONField(name = "dipFlag", ordinal = 4)
        private Boolean dipFlag;

        /**
         * 闪变使能标志
         */
        @JSONField(name = "flickerFlag", ordinal = 5)
        private Boolean flickerFlag;

        /**
         * 通道信息 枚举类型，包括{Ua, Ub, Uc, Ux, Ia, Ib, Ic, Ix ,NULL}
         */
        @JSONField(name = "channelType", ordinal = 6)
        private String channelType;

        /**
         * 幅值
         */
        @JSONField(name = "fAmp", ordinal = 7)
        private Double fAmp;

        /**
         * 相角
         */
        @JSONField(name = "fPhase", ordinal = 8)
        private Double fPhase;

        /**
         * 谐波叠加列表
         */
        @JSONField(name = "harmList", ordinal = 9)
        private List<HarmModel> harmList;

        /**
         * 间谐波叠加列表
         */
        @JSONField(name = "inharmList", ordinal = 10)
        private List<InharmModel> inharmList;

        /**
         * 暂态数据
         */
        @JSONField(name = "dipData", ordinal = 11)
        private DipDataDTO dipData;

        /**
         * 闪变数据
         */
        @JSONField(name = "flickerData", ordinal = 12)
        private FlickerDataDTO flickerData;


        /**
         * 谐波叠加列表
         */
        @NoArgsConstructor
        @Data
        public static class HarmModel {

            /**
             * 谐波次数
             */
            @JSONField(name = "harm", ordinal = 1)
            private Double harm;

            /**
             * 谐波含有率
             */
            @JSONField(name = "fAmp", ordinal = 2)
            private Double fAmp;

            /**
             * 谐波相角
             */
            @JSONField(name = "fPhase", ordinal = 3)
            private Double fPhase;

        }

        /**
         * 间谐波叠加列表
         */
        @NoArgsConstructor
        @Data
        public static class InharmModel {

            /**
             * 间谐波次数
             */
            @JSONField(name = "inharm", ordinal = 1)
            private Double inharm;

            /**
             * 间谐波含有率
             */
            @JSONField(name = "fAmp", ordinal = 2)
            private Double fAmp;

            /**
             * 间谐波相角
             */
            @JSONField(name = "fPhase", ordinal = 3)
            private Double fPhase;

        }


        /**
         * 暂态数据
         */
        @NoArgsConstructor
        @Data
        public static class DipDataDTO {

            /**
             * 暂态幅值（%）
             */
            @JSONField(name = "fTransValue", ordinal = 1)
            private Double fTransValue;

            /**
             * 暂态前时间（s）
             */
            @JSONField(name = "fPreTime", ordinal = 2)
            private Double fPreTime;

            /**
             * 写入时间（s）
             */
            @JSONField(name = "fRampIn", ordinal = 3)
            private Double fRampIn;

            /**
             * 暂态持续时间（s）
             */
            @JSONField(name = "fRetainTime", ordinal = 4)
            private Double fRetainTime;

            @JSONField(serialize = false)
            private Double retainTime;

            /**
             * 写出时间（s）
             */
            @JSONField(name = "fRampOut", ordinal = 5)
            private Double fRampOut;

            /**
             * 暂态后时间（s）
             */
            @JSONField(name = "fAfterTime", ordinal = 6)
            private Double fAfterTime;
        }

        /**
         * 闪变数据
         */
        @NoArgsConstructor
        @Data
        public static class FlickerDataDTO {

            /**
             * 波动类型
             */
            @JSONField(name = "waveFluType", ordinal = 1)
            private String waveFluType;

            /**
             * 闪变调制波形类型
             */
            @JSONField(name = "waveType", ordinal = 2)
            private String waveType;

            /**
             * 闪变标准值
             */
            @JSONField(serialize = false)
            private Double flickerValue;

            /**
             * 占空比
             */
            @JSONField(name = "fDutyCycle", ordinal = 3)
            private Double fDutyCycle;

            /**
             * 变动次数
             */
            @JSONField(name = "fChagFre", ordinal = 4)
            private Double fChagFre;

            /**
             * 变动量
             */
            @JSONField(name = "fChagValue", ordinal = 5)
            private Double fChagValue;
        }
    }
}
