package de.cannamanage.domain.entity;

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

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

@Entity
@Table(name = "batches",
    uniqueConstraints = {
        @UniqueConstraint(columnNames = {"batch_code", "tenant_id"})
    }
)
public class Batch extends AbstractTenantEntity {

    @Column(name = "strain_id", nullable = false)
    private UUID strainId;

    @Column(name = "quantity_grams", nullable = false, precision = 10, scale = 2)
    private BigDecimal quantityGrams;

    @Column(name = "harvest_date")
    private LocalDate harvestDate;

    @Column(name = "batch_code", nullable = false, length = 100)
    private String batchCode;

    @Enumerated(EnumType.STRING)
    @Column(name = "status", nullable = false, length = 50)
    private BatchStatus status = BatchStatus.AVAILABLE;

    @Column(name = "contamination_flag", nullable = false)
    private boolean contaminationFlag = false;

    public UUID getStrainId() { return strainId; }
    public void setStrainId(UUID strainId) { this.strainId = strainId; }

    public BigDecimal getQuantityGrams() { return quantityGrams; }
    public void setQuantityGrams(BigDecimal quantityGrams) { this.quantityGrams = quantityGrams; }

    public LocalDate getHarvestDate() { return harvestDate; }
    public void setHarvestDate(LocalDate harvestDate) { this.harvestDate = harvestDate; }

    public String getBatchCode() { return batchCode; }
    public void setBatchCode(String batchCode) { this.batchCode = batchCode; }

    public BatchStatus getStatus() { return status; }
    public void setStatus(BatchStatus status) { this.status = status; }

    public boolean isContaminationFlag() { return contaminationFlag; }
    public void setContaminationFlag(boolean contaminationFlag) { this.contaminationFlag = contaminationFlag; }
}
