package de.cannamanage.domain.entity;

import jakarta.persistence.*;

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

@Entity
@Table(name = "grow_photos")
public class GrowPhoto {

    @Id
    @GeneratedValue(strategy = GenerationType.UUID)
    @Column(name = "id", nullable = false, updatable = false)
    private UUID id;

    @Column(name = "grow_entry_id", nullable = false)
    private UUID growEntryId;

    @Column(name = "file_path", nullable = false, length = 500)
    private String filePath;

    @Column(name = "caption", length = 255)
    private String caption;

    @Column(name = "taken_at", nullable = false)
    private Instant takenAt;

    @PrePersist
    void onCreate() {
        if (this.takenAt == null) this.takenAt = Instant.now();
    }

    public UUID getId() { return id; }
    public void setId(UUID id) { this.id = id; }

    public UUID getGrowEntryId() { return growEntryId; }
    public void setGrowEntryId(UUID growEntryId) { this.growEntryId = growEntryId; }

    public String getFilePath() { return filePath; }
    public void setFilePath(String filePath) { this.filePath = filePath; }

    public String getCaption() { return caption; }
    public void setCaption(String caption) { this.caption = caption; }

    public Instant getTakenAt() { return takenAt; }
    public void setTakenAt(Instant takenAt) { this.takenAt = takenAt; }
}
