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

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

import java.util.List;


/**
 * @author caozehui
 * @date 2024-11-18
 */
@Data
public class PqScriptDtlsParam {

    /**
     * 检测脚本
     */
    private String scriptId;

    /**
     * 检测脚本类型
     */
    private String scriptType;

    /**
     * 描述
     */
    private String desc;

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

    /**
     * 检测序号
     */
    private Integer index;

    /**
     * 被检设备额定电压
     */
    @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 = "retryCompute", ordinal = 6)
    private Boolean retryCompute = false;
    /**
     * 装置下发参数
     */
    @JSONField(name = "channelList", ordinal = 7)
    private List<CheckData> checkDataList;

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

    @Data
    public static class CheckData {

        /**
         * 检测指标类型，与数据字典关联（例如电压有效值、谐波电压含有率等）
         */
        private String valueType;

        /**
         * 检测指标类型父id
         */
        private String pid;

        /**
         * 相别,字典表
         */
        private String phase;

        /**
         * 值
         */
        private Double value;

        /**
         * (间)谐波次数
         */
        private Double harmNum;

        /**
         * 状态：0-不启用 1-启用
         */
        private Integer enable;

        /**
         * 是否参与误差比较：0-不参与 1-参与
         */
        private Integer errorFlag;


    }

    @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;


        /**
         * 谐波叠加列表
         */
        @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;

        }

        /**
         * 间谐波叠加列表
         */
        @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;

        }


        /**
         * 暂态数据
         */
        @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;
        }

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

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

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

            /**
             * 闪变标准值
             */
            @JSONField(name = "waveType", ordinal = 2)
            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;
        }
    }


}

