require "kemal"
require "./metrics_manager"

module ContainerMom
  VERSION = "0.1.0"

  # Initialize metrics manager
  metrics = MetricsManager.instance

  # Set up Kemal routes
  get "/metrics" do |env|
    metrics.metrics_handler.call(env)
  end

  get "/health" do |env|
    env.response.content_type = "application/json"
    metrics.health_metrics.to_json
  end

  # Start the server
  Kemal.run do |config|
    server = config.server.not_nil!
    server.bind_tcp "0.0.0.0", 8080
  end
end
