package at.procon.dip.domain.ted.config;

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

@Configuration
@ConfigurationProperties(prefix = "dip.ted.projection")
@Validated
@Data
public class TedProjectionProperties {
    private boolean enabled = true;
    private boolean startupBackfillEnabled = false;
    /**
     * Maximum number of legacy TED documents to backfill on startup. 0 means no limit.
     */
    @Min(0)
    private int startupBackfillLimit = 250;
    @Positive
    private int structuredSearchHybridCandidateLimit = 5000;
    @Positive
    private int structuredSearchFacetBucketLimit = 12;
    private LotDocuments lotDocuments = new LotDocuments();

    @Data
    public static class LotDocuments {
        /**
         * Materialize one canonical DOC document of type TED_NOTICE_LOT per TED lot.
         */
        private boolean enabled = false;
        /**
         * Optional startup/backfill path for notices that were imported before lot documents existed.
         */
        private boolean startupBackfillEnabled = false;
        /**
         * Maximum number of projections to backfill on startup. 0 means no limit.
         */
        @Min(0)
        private int startupBackfillLimit = 1000;
        /**
         * Queue embeddings whenever the lot semantic text representation is created or changed.
         */
        private boolean queueEmbeddings = false;
        /**
         * Include parent notice project description even when the lot already has its own description.
         */
        private boolean includeProjectDescription = false;
    }
}
