package at.procon.dip.embedding.registry;

import at.procon.dip.embedding.provider.EmbeddingProvider;
import java.util.List;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;

@Component
@RequiredArgsConstructor
public class EmbeddingProviderRegistry {

    private final List<EmbeddingProvider> providers;

    public EmbeddingProvider getRequired(String providerType) {
        return providers.stream()
                .filter(provider -> provider.providerType().equalsIgnoreCase(providerType))
                .findFirst()
                .orElseThrow(() -> new IllegalArgumentException("No embedding provider registered for type: " + providerType));
    }
}
