package app.mealsmadeeasy.api.recipe;

import jakarta.persistence.*;
import lombok.Data;
import org.hibernate.annotations.Array;
import org.hibernate.annotations.JdbcTypeCode;
import org.hibernate.type.SqlTypes;
import org.jetbrains.annotations.Nullable;

import java.time.OffsetDateTime;

@Entity
@Table(name = "recipe_summary")
@Data
public class RecipeSummary {

    @Id
    private Integer id;

    @OneToOne(fetch = FetchType.LAZY, optional = false)
    @MapsId
    @JoinColumn(name = "recipe_id")
    private Recipe recipe;

    @Column(columnDefinition = "TEXT")
    private @Nullable String summary;

    @JdbcTypeCode(SqlTypes.VECTOR)
    @Array(length = 1024)
    private @Nullable float[] embedding;

    @Column(nullable = false)
    private OffsetDateTime timestamp;

}
