package com.gnx.telemedicine.model;

import jakarta.persistence.*;
import lombok.Getter;
import lombok.Setter;

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

@Getter
@Setter
@Entity
@Table(name = "data_minimization_logs")
public class DataMinimizationLog {
    @Id
    @GeneratedValue(strategy = GenerationType.UUID)
    @Column(name = "id")
    private UUID id;

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "user_id", nullable = false)
    private UserModel user;

    @Column(name = "action_type", nullable = false)
    private String actionType; // COLLECTED, ACCESSED, MODIFIED, DELETED

    @Column(name = "data_category", nullable = false)
    private String dataCategory;

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

    @Column(name = "legal_basis")
    private String legalBasis;

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

    @Column(name = "ip_address")
    private String ipAddress;

    @Column(name = "user_agent", columnDefinition = "TEXT")
    private String userAgent;
}

