# Central Import Registry
# Provides aliases for all available templates and core extensions

# === CORE EXTENSIONS (Layer 1) ===
# Core taskservs from provisioning/extensions
alias core_kubernetes = import("../../extensions/taskservs/kubernetes/kcl/kubernetes.k")
alias core_cilium = import("../../extensions/taskservs/cilium/kcl/cilium.k")
alias core_containerd = import("../../extensions/taskservs/containerd/kcl/containerd.k")
alias core_crio = import("../../extensions/taskservs/crio/kcl/crio.k")
alias core_rook_ceph = import("../../extensions/taskservs/rook-ceph/kcl/rook-ceph.k")
alias core_postgres = import("../../extensions/taskservs/postgres/kcl/postgres.k")
alias core_redis = import("../../extensions/taskservs/redis/kcl/redis.k")
alias core_etcd = import("../../extensions/taskservs/etcd/kcl/etcd.k")
alias core_coredns = import("../../extensions/taskservs/coredns/kcl/coredns.k")
alias core_proxy = import("../../extensions/taskservs/proxy/kcl/proxy.k")

# Core providers from provisioning/extensions
alias core_upcloud_prov = import("../../extensions/providers/upcloud/kcl/upcloud.k")
alias core_aws_prov = import("../../extensions/providers/aws/kcl/aws.k")
alias core_local_prov = import("../../extensions/providers/local/kcl/local.k")

# === WORKSPACE TEMPLATES (Layer 2) ===
# Template base configurations
alias tpl_kubernetes_base = import("../templates/taskservs/kubernetes/base.k")
alias tpl_kubernetes_ha = import("../templates/taskservs/kubernetes/variants/ha-cluster.k")
alias tpl_kubernetes_single = import("../templates/taskservs/kubernetes/variants/single-node.k")

# Provider templates
alias tpl_upcloud_defaults = import("../templates/providers/upcloud/defaults.k")
alias tpl_aws_defaults = import("../templates/providers/aws/defaults.k")

# Server templates
alias tpl_server_controlplane = import("../templates/servers/control-plane.k")
alias tpl_server_worker = import("../templates/servers/worker-node.k")

# Storage templates
alias tpl_rook_ceph = import("../templates/taskservs/storage/rook-ceph.k")
alias tpl_mayastor = import("../templates/taskservs/storage/mayastor.k")

# Networking templates
alias tpl_cilium = import("../templates/taskservs/networking/cilium.k")
alias tpl_coredns = import("../templates/taskservs/networking/coredns.k")

# === COMPOSITION UTILITIES ===
# Utility libraries for template composition
alias compose = import("../templates/lib/compose.k")
alias override = import("../templates/lib/override.k")
alias layer = import("../templates/lib/layer.k")

# Layer definitions
alias layer_core = import("../layers/core.layer.k")
alias layer_workspace = import("../layers/workspace.layer.k")
alias layer_infra = import("../layers/infra.layer.k")

# === COMMON PATTERNS ===
# Frequently used combinations
alias pattern_k8s_basic = {
    kubernetes = tpl_kubernetes_base
    cni = tpl_cilium
    dns = tpl_coredns
}

alias pattern_k8s_ha = {
    kubernetes = tpl_kubernetes_ha
    storage = tpl_rook_ceph
    cni = tpl_cilium
    dns = tpl_coredns
}

alias pattern_upcloud_standard = {
    provider = tpl_upcloud_defaults
    runtime = core_containerd
    orchestrator = tpl_kubernetes_base
}

# === EXPORT REGISTRY ===
# Make registry items available for import by other modules
registry_exports = {
    # Core extensions
    core = {
        kubernetes = core_kubernetes
        cilium = core_cilium
        containerd = core_containerd
        crio = core_crio
        rook_ceph = core_rook_ceph
        postgres = core_postgres
        redis = core_redis
        etcd = core_etcd
        coredns = core_coredns
        proxy = core_proxy
    }

    # Templates
    templates = {
        kubernetes = {
            base = tpl_kubernetes_base
            ha = tpl_kubernetes_ha
            single = tpl_kubernetes_single
        }
        providers = {
            upcloud = tpl_upcloud_defaults
            aws = tpl_aws_defaults
        }
        servers = {
            controlplane = tpl_server_controlplane
            worker = tpl_server_worker
        }
        storage = {
            rook_ceph = tpl_rook_ceph
            mayastor = tpl_mayastor
        }
        networking = {
            cilium = tpl_cilium
            coredns = tpl_coredns
        }
    }

    # Patterns
    patterns = {
        k8s_basic = pattern_k8s_basic
        k8s_ha = pattern_k8s_ha
        upcloud_standard = pattern_upcloud_standard
    }

    # Utilities
    utilities = {
        compose = compose
        override = override
        layer = layer
    }

    # Layers
    layers = {
        core = layer_core
        workspace = layer_workspace
        infra = layer_infra
    }
}
