package org.raddatz.familienarchiv.document.transcription;

import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.persistence.*;
import lombok.*;
import org.hibernate.annotations.CreationTimestamp;

import java.time.LocalDateTime;
import java.util.UUID;

@Entity
@Table(name = "transcription_block_versions")
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class TranscriptionBlockVersion {

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

    @Column(name = "block_id", nullable = false)
    @Schema(requiredMode = Schema.RequiredMode.REQUIRED)
    private UUID blockId;

    @Column(nullable = false, columnDefinition = "TEXT")
    @Schema(requiredMode = Schema.RequiredMode.REQUIRED)
    private String text;

    @Column(name = "changed_by")
    private UUID changedBy;

    @Column(name = "changed_at", nullable = false, updatable = false)
    @CreationTimestamp
    @Schema(requiredMode = Schema.RequiredMode.REQUIRED)
    private LocalDateTime changedAt;
}
