package ai.decompile.engine.service;

import ai.decompile.engine.model.dto.EngineResponse;
import java.util.List;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

@Service
@RequiredArgsConstructor
public class EngineDiscoveryService {
  private final List<EngineService> engineServices;

  public List<EngineResponse> listEngines() {
    return engineServices.stream()
        .map(
            e -> {
              var type = e.supportedEngine();
              return new EngineResponse(type.name(), type.getLabel(), e.isAvailable());
            })
        .toList();
  }
}
