package at.procon.eventhub.processing.eventprocessing;

import at.procon.eventhub.processing.eventprocessing.dto.RuntimeEventProcessingApiRequest;
import at.procon.eventhub.processing.eventprocessing.dto.RuntimeEventProcessingResultDto;
import at.procon.eventhub.processing.eventprocessing.dto.RuntimeEventProcessingProfileDescriptorDto;
import java.util.List;
import at.procon.eventhub.processing.eventprocessing.profile.RuntimeEventProcessingProfileRegistry;
import org.springframework.stereotype.Service;

@Service
public class RuntimeEventProcessingService {

    private final RuntimeEventProcessingProfileRegistry profileRegistry;

    public RuntimeEventProcessingService(RuntimeEventProcessingProfileRegistry profileRegistry) {
        this.profileRegistry = profileRegistry;
    }

    public RuntimeEventProcessingResultDto process(RuntimeEventProcessingApiRequest request) {
        return profileRegistry.require(request.profileKey()).process(request);
    }

    public List<RuntimeEventProcessingProfileDescriptorDto> listProfiles() {
        return profileRegistry.profileDescriptors();
    }
}
