package org.raddatz.familienarchiv.ocr;

import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.persistence.*;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.CreationTimestamp;
import org.hibernate.annotations.UpdateTimestamp;

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

@Entity
@Table(name = "sender_models")
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class SenderModel {

    @Id
    @GeneratedValue(strategy = GenerationType.UUID)
    @Schema(requiredMode = Schema.RequiredMode.REQUIRED)
    private UUID id;

    @Column(name = "person_id", nullable = false, unique = true)
    @Schema(requiredMode = Schema.RequiredMode.REQUIRED)
    private UUID personId;

    @JsonIgnore
    @Column(name = "model_path", nullable = false)
    private String modelPath;

    @Column
    private Double accuracy;

    @Column
    private Double cer;

    @Column(name = "corrected_lines_at_training", nullable = false)
    @Schema(requiredMode = Schema.RequiredMode.REQUIRED)
    private int correctedLinesAtTraining;

    @CreationTimestamp
    @Column(name = "created_at", nullable = false, updatable = false)
    @Schema(requiredMode = Schema.RequiredMode.REQUIRED)
    private Instant createdAt;

    @UpdateTimestamp
    @Column(name = "updated_at", nullable = false)
    @Schema(requiredMode = Schema.RequiredMode.REQUIRED)
    private Instant updatedAt;
}
