package ch.zhaw.gartenverwaltung.types;

import ch.zhaw.gartenverwaltung.json.GrowthPhaseTypeDeserializer;
import ch.zhaw.gartenverwaltung.json.HardinessZoneDeserializer;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;

import java.time.MonthDay;
import java.util.List;

/**
 * Represents a growth phase of a plant.
 * Plants go through several phases during their life (sowing, germinating, growing, ..., harvest).
 * These phases are characterized by what kinds of tasks need to be executed by the gardener to stay alive.
 * This class represents one such phase.
 *
 * @param startDate The earliest date on which this phase can start
 * @param endDate The latest date on which this phase can start
 * @param group Which group this phase belongs to (if the growth phase can occur multiple times a year, default: 0)
 * @param type What {@link GrowthPhaseType} this represents
 * @param zone The hardiness zone for which this growth phase is valid
 * @param taskTemplates The (undated) tasks required to be performed by the gardener
 */
public record GrowthPhase(
        MonthDay startDate,
        MonthDay endDate,
        int group,
        @JsonDeserialize(using = GrowthPhaseTypeDeserializer.class) GrowthPhaseType type,
        @JsonDeserialize(using = HardinessZoneDeserializer.class) HardinessZone zone,
        List<TaskTemplate> taskTemplates) {
}
