package de.cannamanage.domain.entity;

import de.cannamanage.domain.enums.TransactionType;
import jakarta.persistence.*;

import java.time.LocalDate;
import java.util.UUID;

/**
 * Kassenbuch entry — append-only per §147 AO (Aufbewahrungspflicht).
 * NO update, NO delete. Corrections are done via compensating entries.
 */
@Entity
@Table(name = "ledger_entries")
public class LedgerEntry extends AbstractTenantEntity {

    @Column(name = "club_id", nullable = false)
    private UUID clubId;

    @Enumerated(EnumType.STRING)
    @Column(name = "transaction_type", nullable = false, length = 10)
    private TransactionType transactionType;

    @Column(name = "category", nullable = false, length = 50)
    private String category;

    @Column(name = "amount_cents", nullable = false)
    private Integer amountCents;

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

    @Column(name = "reference", length = 200)
    private String reference;

    @Column(name = "payment_id")
    private UUID paymentId;

    @Column(name = "recorded_by", nullable = false)
    private UUID recordedBy;

    @Column(name = "transaction_date", nullable = false)
    private LocalDate transactionDate;

    // Getters and setters

    public UUID getClubId() { return clubId; }
    public void setClubId(UUID clubId) { this.clubId = clubId; }

    public TransactionType getTransactionType() { return transactionType; }
    public void setTransactionType(TransactionType transactionType) { this.transactionType = transactionType; }

    public String getCategory() { return category; }
    public void setCategory(String category) { this.category = category; }

    public Integer getAmountCents() { return amountCents; }
    public void setAmountCents(Integer amountCents) { this.amountCents = amountCents; }

    public String getDescription() { return description; }
    public void setDescription(String description) { this.description = description; }

    public String getReference() { return reference; }
    public void setReference(String reference) { this.reference = reference; }

    public UUID getPaymentId() { return paymentId; }
    public void setPaymentId(UUID paymentId) { this.paymentId = paymentId; }

    public UUID getRecordedBy() { return recordedBy; }
    public void setRecordedBy(UUID recordedBy) { this.recordedBy = recordedBy; }

    public LocalDate getTransactionDate() { return transactionDate; }
    public void setTransactionDate(LocalDate transactionDate) { this.transactionDate = transactionDate; }
}
