package devcontainer

import (
	"fmt"
	"strings"

	"zlh-agent/internal/state"

	devgo "zlh-agent/internal/provision/devcontainer/go"
	"zlh-agent/internal/provision/devcontainer/java"
	"zlh-agent/internal/provision/devcontainer/node"
	"zlh-agent/internal/provision/devcontainer/python"
)

func Provision(cfg state.Config) error {
	runtime := strings.ToLower(cfg.Runtime)

	switch runtime {
	case "node":
		return node.Install(cfg)
	case "python":
		return python.Install(cfg)
	case "go":
		return devgo.Install(cfg)
	case "java":
		return java.Install(cfg)
	default:
		return fmt.Errorf("unsupported dev container runtime: %s", runtime)
	}
}
