package gc.mda.kcg.domain.stats;

import jakarta.persistence.*;
import lombok.*;
import org.hibernate.annotations.JdbcTypeCode;
import org.hibernate.type.SqlTypes;

import java.time.OffsetDateTime;
import java.util.Map;

@Entity
@Table(name = "prediction_stats_hourly", schema = "kcg")
@Getter @Setter @NoArgsConstructor @AllArgsConstructor @Builder
public class PredictionStatsHourly {

    @Id
    @Column(name = "stat_hour")
    private OffsetDateTime statHour;

    @Column(name = "total_detections")
    private Integer totalDetections;

    @JdbcTypeCode(SqlTypes.JSON)
    @Column(name = "by_category", columnDefinition = "jsonb")
    private Map<String, Object> byCategory;

    @JdbcTypeCode(SqlTypes.JSON)
    @Column(name = "by_zone", columnDefinition = "jsonb")
    private Map<String, Object> byZone;

    @JdbcTypeCode(SqlTypes.JSON)
    @Column(name = "by_risk_level", columnDefinition = "jsonb")
    private Map<String, Object> byRiskLevel;

    @Column(name = "event_count")
    private Integer eventCount;

    @Column(name = "critical_count")
    private Integer criticalCount;

    @Column(name = "updated_at")
    private OffsetDateTime updatedAt;
}
