package com.usky.ai.dto;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;

import java.util.List;

@Data
@JsonIgnoreProperties(ignoreUnknown = true)
public class EdgeAlgTaskConfigRequestDTO {
    @JsonProperty("BoardId")
    private String boardId;
    @JsonProperty("Event")
    private String event = "/alg_task_config";
    @JsonProperty("AlgTaskSession")
    private String algTaskSession;
    @JsonProperty("TaskDesc")
    private String taskDesc;
    @JsonProperty("AlgInfo")
    private List<Integer> algInfo;
    @JsonProperty("MediaName")
    private String mediaName;
    @JsonProperty("MetadataUrl")
    private List<String> metadataUrl;
    @JsonProperty("ScheduleId")
    private Integer scheduleId = -1;
    @JsonProperty("UserData")
    private UserData userData;
    @JsonProperty("RuleProperty")
    private List<RuleProperty> ruleProperty;
    @JsonProperty("Template")
    private String template = "";
    @JsonProperty("GB28181Channel")
    private String gb28181Channel = "";
    @JsonProperty("AlarmProtocol")
    private Integer alarmProtocol = 0;
    @JsonProperty("AlarmBody")
    private Integer alarmBody = 0;
    @JsonProperty("Restart")
    private Boolean restart = true;

    @Data
    public static class UserData {
        @JsonProperty("MethodConfig")
        private List<Integer> methodConfig;

        /* 离岗算法业务字段 */
        @JsonProperty("staff_sec")
        private Integer staffSec;
        @JsonProperty("staff_number")
        private Integer staffNumber;
    }

    @Data
    public static class RuleProperty {
        @JsonProperty("Algo")
        private Algo algo;
        @JsonProperty("Points")
        private List<Point> points;
        @JsonProperty("RuleId")
        private String ruleId;
        @JsonProperty("RuleType")
        private Integer ruleType;

        @Data
        public static class Algo {
            @JsonProperty("majorId")
            private Integer majorId;
            @JsonProperty("minorId")
            private Integer minorId;
        }

        @Data
        public static class Point {
            @JsonProperty("X")
            private Double x;
            @JsonProperty("Y")
            private Double y;
        }
    }
}
