package com.qaup.collision.websocket.message;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.AllArgsConstructor;
import lombok.Builder;

/**
 * 规则违规事件WebSocket消息载荷
 * 用于实时推送规则违规事件到前端
 * 
 * @author AI Assistant
 * @since 2025-01-17
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@JsonInclude(JsonInclude.Include.NON_NULL) // 只序列化非null字段
public class RuleViolationPayload {

    /**
     * 车辆类型
     */
    @JsonProperty("vehicleType")
    private String vehicleType;

    /**
     * 车牌号
     */
    @JsonProperty("vehicleLicense")
    private String vehicleLicense;

    /**
     * 规则
     */
    @JsonProperty("ruleType")
    private String ruleType;

    /**
     * 规则名称
     */
    @JsonProperty("ruleName")
    private String ruleName;

    /**
     * 违规类型
     */
    @JsonProperty("violationType")
    private String violationType;

    /**
     * 告警级别
     */
    @JsonProperty("alertLevel")
    private String alertLevel;

    /**
     * 实际值
     */
    @JsonProperty("actualValue")
    private Double actualValue;

    /**
     * 限制值
     */
    @JsonProperty("limitValue")
    private Double limitValue;

    /**
     * 违规位置 (经纬度对象)
     */
    @JsonProperty("position")
    private Position position;

    /**
     * 违规描述
     */
    @JsonProperty("description")
    private String description;

    /**
     * 是否需要立即响应
     */
    @JsonProperty("requiresImmediateResponse")
    private Boolean requiresImmediateResponse;

    /**
     * 是否为紧急事件
     */
    @JsonProperty("isCritical")
    private Boolean isCritical;

    /**
     * 处理建议
     */
    @JsonProperty("recommendedAction")
    private String recommendedAction;

    /**
     * 事件状态
     */
    @JsonProperty("status")
    private String status;

    @Data
    @Builder
    @NoArgsConstructor
    @AllArgsConstructor
    @JsonInclude(JsonInclude.Include.NON_NULL)
    public static class Position {
        @JsonProperty("latitude")
        private Double latitude;
        @JsonProperty("longitude")
        private Double longitude;
    }
} 