package com.walkguide.entity;

import jakarta.persistence.*;
import lombok.*;
import java.time.LocalDateTime;

@Entity
@Table(name = "ai_configs")
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class AiConfig {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    @Column(name = "guardian_id")
    private Long guardianId;

    @Column(name = "user_id", nullable = false, unique = true)
    private Long userId;

    @Column(name = "confidence_threshold", nullable = false)
    @Builder.Default
    private Double confidenceThreshold = 0.5;

    @Column(name = "alert_distance_close", nullable = false)
    @Builder.Default
    private Double alertDistanceClose = 1.5;

    @Column(name = "alert_distance_medium", nullable = false)
    @Builder.Default
    private Double alertDistanceMedium = 3.0;

    @Column(name = "max_inference_fps", nullable = false)
    @Builder.Default
    private Integer maxInferenceFps = 5;

    @Column(name = "enabled_labels", nullable = false, columnDefinition = "TEXT")
    @Builder.Default
    private String enabledLabels = "ALL";

    @Column(name = "updated_at", nullable = false)
    private LocalDateTime updatedAt;

    @PrePersist
    @PreUpdate
    protected void onUpdate() {
        updatedAt = LocalDateTime.now();
    }
}
