package com.gnx.telemedicine.model;

import com.gnx.telemedicine.model.enums.DisclosureType;
import jakarta.persistence.*;
import lombok.Getter;
import lombok.Setter;

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

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

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "patient_id", nullable = false)
    private Patient patient;

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

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

    @Enumerated(EnumType.STRING)
    @Column(name = "disclosure_type", nullable = false)
    private DisclosureType disclosureType;

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

    @Column(name = "recipient_name")
    private String recipientName;

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

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

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "authorized_by")
    private UserModel authorizedBy;

    @Column(name = "authorization_date")
    private Instant authorizationDate;

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

