package de.effigenix.infrastructure.production.persistence.entity;

import jakarta.persistence.*;

@Entity
@Table(name = "recipe_production_steps",
        uniqueConstraints = @UniqueConstraint(name = "uq_recipe_step_number", columnNames = {"recipe_id", "step_number"}))
public class ProductionStepEntity {

    @Id
    @Column(name = "id", nullable = false, length = 36)
    private String id;

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "recipe_id", nullable = false)
    private RecipeEntity recipe;

    @Column(name = "step_number", nullable = false)
    private int stepNumber;

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

    @Column(name = "duration_minutes")
    private Integer durationMinutes;

    @Column(name = "temperature_celsius")
    private Integer temperatureCelsius;

    protected ProductionStepEntity() {}

    public ProductionStepEntity(String id, RecipeEntity recipe, int stepNumber, String description,
                                Integer durationMinutes, Integer temperatureCelsius) {
        this.id = id;
        this.recipe = recipe;
        this.stepNumber = stepNumber;
        this.description = description;
        this.durationMinutes = durationMinutes;
        this.temperatureCelsius = temperatureCelsius;
    }

    public String getId() { return id; }
    public RecipeEntity getRecipe() { return recipe; }
    public int getStepNumber() { return stepNumber; }
    public String getDescription() { return description; }
    public Integer getDurationMinutes() { return durationMinutes; }
    public Integer getTemperatureCelsius() { return temperatureCelsius; }

    public void setId(String id) { this.id = id; }
    public void setRecipe(RecipeEntity recipe) { this.recipe = recipe; }
    public void setStepNumber(int stepNumber) { this.stepNumber = stepNumber; }
    public void setDescription(String description) { this.description = description; }
    public void setDurationMinutes(Integer durationMinutes) { this.durationMinutes = durationMinutes; }
    public void setTemperatureCelsius(Integer temperatureCelsius) { this.temperatureCelsius = temperatureCelsius; }
}
