package at.procon.eventhub.yellowfox.service;

import at.procon.eventhub.importing.ImportPlanItemDto;
import at.procon.eventhub.importing.ImportTimeChunkDto;
import at.procon.eventhub.importing.extraction.AbstractNoopExtractionBatchExecutor;
import at.procon.eventhub.yellowfox.dto.YellowFoxD8ExtractionBatchResultDto;
import at.procon.eventhub.yellowfox.dto.YellowFoxD8ImportRequest;
import java.util.UUID;
import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
import org.springframework.stereotype.Service;

@Service
@ConditionalOnExpression("!T(org.springframework.util.StringUtils).hasText('${eventhub.yellow-fox.datasource.jdbc-url:}')")
public class NoopYellowFoxD8ExtractionBatchExecutor
        extends AbstractNoopExtractionBatchExecutor<YellowFoxD8ImportRequest, YellowFoxD8ExtractionBatchResultDto>
        implements YellowFoxD8ExtractionBatchExecutor {

    @Override
    protected YellowFoxD8ExtractionBatchResultDto emptyResult(
            UUID packageId,
            ImportPlanItemDto planItem,
            ImportTimeChunkDto chunk
    ) {
        return new YellowFoxD8ExtractionBatchResultDto(
                packageId,
                planItem.extractionCode(),
                planItem.sourceKind(),
                0,
                0,
                0,
                0,
                false,
                null,
                null,
                null,
                null,
                java.util.Map.of()
        );
    }

    @Override
    protected String providerName() {
        return "yellowfox-d8";
    }
}
