package com.gnx.telemedicine.model;

import jakarta.persistence.*;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.UpdateTimestamp;

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

@Getter
@Setter
@Entity
@Table(name = "data_retention_policies", uniqueConstraints = {
    @UniqueConstraint(columnNames = {"data_type"})
})
public class DataRetentionPolicy {
    @Id
    @GeneratedValue(strategy = GenerationType.UUID)
    @Column(name = "id")
    private UUID id;

    @Column(name = "data_type", nullable = false, unique = true)
    private String dataType;

    @Column(name = "retention_period_days", nullable = false)
    private Integer retentionPeriodDays;

    @Column(name = "auto_delete_enabled")
    private Boolean autoDeleteEnabled = false;

    @Column(name = "legal_requirement", columnDefinition = "TEXT")
    private String legalRequirement;

    @Column(name = "last_cleanup_at")
    private Instant lastCleanupAt;

    @Column(name = "created_at", nullable = false, updatable = false)
    private Instant createdAt = Instant.now();

    @UpdateTimestamp
    @Column(name = "updated_at", nullable = false)
    private Instant updatedAt = Instant.now();
}

