package at.procon.dip.ingestion.config;

import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Positive;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;

/**
 * NEW-runtime TED package download configuration.
 * <p>
 * This is intentionally separate from the legacy {@code ted.download.*} tree.
 */
@Configuration
@ConfigurationProperties(prefix = "dip.ingestion.ted-download")
@Data
public class TedPackageDownloadProperties {

    private boolean enabled = false;

    @NotBlank
    private String baseUrl = "https://ted.europa.eu/packages/daily/";

    @NotBlank
    private String downloadDirectory = "/ted.europe/downloads-new";

    @Positive
    private int startYear = 2015;

    @Positive
    private long pollInterval = 3_600_000L;

    @Positive
    private long notFoundRetryInterval = 21_600_000L;

    @Min(0)
    private int previousYearGracePeriodDays = 30;

    private boolean retryCurrentYearNotFoundIndefinitely = true;

    @Positive
    private long downloadTimeout = 300_000L;

    @Positive
    private int maxRunningPackages = 2;

    @Positive
    private long delayBetweenDownloads = 5_000L;

    private boolean deleteAfterIngestion = true;
}
