# Import Helper Functions
# Provides clean, environment-based imports to avoid relative paths

use ../config/accessor.nu *

# Provider middleware imports
export def prov-middleware [] {
    (get-prov-lib-path) | path join "middleware.nu"
}

export def prov-env-middleware [] {
    (get-prov-lib-path) | path join "env_middleware.nu"
}

# Provider-specific imports
export def aws-env [] {
    (get-providers-path) | path join "aws" "nulib" "aws" "env.nu"
}

export def aws-servers [] {
    (get-providers-path) | path join "aws" "nulib" "aws" "servers.nu"
}

export def upcloud-env [] {
    (get-providers-path) | path join "upcloud" "nulib" "upcloud" "env.nu"
}

export def upcloud-servers [] {
    (get-providers-path) | path join "upcloud" "nulib" "upcloud" "servers.nu"
}

export def local-env [] {
    (get-providers-path) | path join "local" "nulib" "local" "env.nu"
}

export def local-servers [] {
    (get-providers-path) | path join "local" "nulib" "local" "servers.nu"
}

# Core module imports
export def core-servers [] {
    (get-core-nulib-path) | path join "servers"
}

export def core-taskservs [] {
    (get-core-nulib-path) | path join "taskservs"
}

export def core-clusters [] {
    (get-core-nulib-path) | path join "clusters"
}

# Lib provisioning imports (for internal cross-references)
export def lib-utils [] {
    (get-core-nulib-path) | path join "lib_provisioning" "utils"
}

export def lib-secrets [] {
    (get-core-nulib-path) | path join "lib_provisioning" "secrets"
}

export def lib-sops [] {
    (get-core-nulib-path) | path join "lib_provisioning" "sops"
}

export def lib-ai [] {
    (get-core-nulib-path) | path join "lib_provisioning" "ai"
}

# Helper for dynamic imports with specific files
export def import-path [base: string, file: string] {
    $base | path join $file
}
