package ai.decompile.engine.config;

import java.util.HashMap;
import java.util.Map;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;

@Data
@Configuration
@ConfigurationProperties(prefix = "app")
public class EngineProperties {
  private Map<String, EngineConfig> engines = new HashMap<>();

  public EngineConfig getEngineConfig(String engineName) {
    var config = engines.get(engineName);
    if (config == null) {
      throw new IllegalArgumentException("No configuration found for engine '" + engineName + "'");
    }

    return config;
  }

  @Data
  public static class EngineConfig {
    private String image;
    private long timeoutSeconds = 300;
  }
}
