package com.qaup.collision.websocket.event;

import lombok.Data;
import lombok.EqualsAndHashCode;

import java.time.Instant;
import java.util.UUID;

import com.qaup.collision.websocket.message.TrafficLightStatusPayload;

/**
 * 红绿灯状态事件
 * 当红绿灯状态发生变化时发布此事件
 */
@Data
@EqualsAndHashCode(callSuper = false)
public class TrafficLightStatusEvent implements WebSocketEvent {
    
    private final String eventId;
    private final long timestamp;
    private final String eventType;
    private final TrafficLightStatusPayload payload;
    
    public TrafficLightStatusEvent(TrafficLightStatusPayload payload) {
        this.eventId = UUID.randomUUID().toString();
        this.timestamp = Instant.now().toEpochMilli() * 1000; // 微秒级时间戳
        this.eventType = "traffic_light_status";
        this.payload = payload;
    }
    
    @Override
    public String getEventId() {
        return eventId;
    }
    
    @Override
    public long getTimestamp() {
        return timestamp;
    }
    
    @Override
    public String getEventType() {
        return eventType;
    }
    
    @Override
    public TrafficLightStatusPayload getPayload() {
        return payload;
    }
} 