package com.astalange.core.entity;

import jakarta.persistence.*;
import java.time.LocalDateTime;
import java.math.BigDecimal;

@Entity
@Table(name = "audit_log_paiement")
public class AuditLogPaiement {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    @Column(nullable = false)
    private String action; // CREATE, UPDATE, DELETE

    @Column(nullable = false)
    private LocalDateTime dateAction;

    @Column(nullable = false)
    private String utilisateur; // Username or 'Système'

    @Column(nullable = true)
    private Long paiementId; // Can be null if the payment is completely deleted or we just want to keep track

    @Column(nullable = false, length = 1000)
    private String details;

    @Column(nullable = true)
    private BigDecimal montant;

    @Column(nullable = true)
    private String adherentNomComplet;

    @PrePersist
    protected void onCreate() {
        this.dateAction = LocalDateTime.now();
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getAction() {
        return action;
    }

    public void setAction(String action) {
        this.action = action;
    }

    public LocalDateTime getDateAction() {
        return dateAction;
    }

    public void setDateAction(LocalDateTime dateAction) {
        this.dateAction = dateAction;
    }

    public String getUtilisateur() {
        return utilisateur;
    }

    public void setUtilisateur(String utilisateur) {
        this.utilisateur = utilisateur;
    }

    public Long getPaiementId() {
        return paiementId;
    }

    public void setPaiementId(Long paiementId) {
        this.paiementId = paiementId;
    }

    public String getDetails() {
        return details;
    }

    public void setDetails(String details) {
        this.details = details;
    }

    public BigDecimal getMontant() {
        return montant;
    }

    public void setMontant(BigDecimal montant) {
        this.montant = montant;
    }

    public String getAdherentNomComplet() {
        return adherentNomComplet;
    }

    public void setAdherentNomComplet(String adherentNomComplet) {
        this.adherentNomComplet = adherentNomComplet;
    }
}
