# Main Entry Point for Provisioning Nickel Module
# This file imports all schemas organized by domain
# Author: JesusPerezLorenzo
# Release: 0.1.0
# Date: 2025-12-15

# ============================================================================
# IMPORTANT: Nickel Import Pattern (Domain-Organized Architecture)
# ============================================================================
# This module uses DIRECT MODULE IMPORTS pattern with domain-based organization.
#
# STRUCTURE:
#   provisioning/schemas/
#   ├── config/        (Settings, defaults, workspace configuration)
#   ├── lib/           (Utilities and validation)
#   ├── infrastructure/
#   │   ├── compute/   (servers, clusters, services)
#   │   ├── storage/   (VMs, volumes, images)
#   │   └── provisioning/ (nested provisioning)
#   ├── operations/
#   │   ├── workflows/ (batch workflows)
#   │   ├── batch/     (batch operations)
#   │   ├── dependencies/ (task dependencies)
#   │   └── tasks/     (commands, system config)
#   ├── deployment/
#   │   ├── kubernetes/ (K8s deployment)
#   │   └── modes/     (execution modes)
#   ├── services/      (Gitea, etc)
#   ├── generator/     (declarations, etc)
#   └── integrations/  (runtime, gitops, etc)
#
# USAGE IN EXTENSIONS:
#   let provisioning = import "path/to/main.ncl" in
#   provisioning.lib           # For Storage, TaskServDef, ClusterDef
#   provisioning.config        # For Settings, Defaults, WorkspaceConfig
#   provisioning.infrastructure # For Server, Cluster, VM configs
#   provisioning.operations    # For Workflows, Batch, Dependencies
#   provisioning.deployment    # For K8s, Modes
#
# EXAMPLE:
#   let provisioning = import "./main.ncl" in
#   let lib = provisioning.lib in
#   let infrastructure = provisioning.infrastructure in
#
#   {
#     storage = {
#       device = "/dev/sda",
#       size = 100,
#     } | lib.Storage,
#   }
# ============================================================================

{
  # ========== LIBRARY & UTILITIES ==========
  lib | doc "Core library types (Storage, TaskServDef, ClusterDef)"
    = import "./lib/main.ncl",

  # ========== CONFIGURATION ==========
  config | doc "Configuration modules (settings, defaults, workspace_config)"
    = {
      settings | doc "Core settings and configuration schemas"
        = import "./config/settings/main.ncl",

      defaults | doc "Default configurations and values"
        = import "./config/defaults/main.ncl",

      workspace_config | doc "Workspace configuration schemas"
        = import "./config/workspace_config/main.ncl",
    },

  # ========== INFRASTRUCTURE ==========
  infrastructure | doc "Infrastructure resource schemas (compute, storage, provisioning)"
    = {
      compute | doc "Compute resources (servers, clusters, services)"
        = {
          server | doc "Server configuration schema"
            = import "./infrastructure/compute/server/main.ncl",

          cluster | doc "Cluster configuration schema"
            = import "./infrastructure/compute/cluster/main.ncl",

          services | doc "Service registry and definitions"
            = import "./infrastructure/compute/services/main.ncl",
        },

      storage | doc "Storage resources (VMs, volumes, golden images)"
        = {
          vm | doc "Virtual machine configuration schemas"
            = import "./infrastructure/storage/vm/main.ncl",

          vm_lifecycle | doc "VM lifecycle management schemas"
            = import "./infrastructure/storage/vm_lifecycle/main.ncl",

          golden_image | doc "Golden image creation schemas"
            = import "./infrastructure/storage/golden_image/main.ncl",
        },

      provisioning | doc "Nested provisioning schemas"
        = {
          nested_provisioning | doc "Nested provisioning schemas"
            = import "./infrastructure/provisioning/nested_provisioning/main.ncl",
        },
    },

  # ========== OPERATIONS ==========
  operations | doc "Operations and workflow management (workflows, batch, dependencies, tasks)"
    = {
      workflows | doc "Batch workflow schemas"
        = import "./operations/workflows/main.ncl",

      batch | doc "Batch scheduler and executor schemas"
        = import "./operations/batch/main.ncl",

      dependencies | doc "Taskserv dependencies and health checks"
        = import "./operations/dependencies/main.ncl",

      tasks | doc "Task execution (commands, system configuration)"
        = {
          commands | doc "Command system schemas"
            = import "./operations/tasks/commands/main.ncl",

          system_config | doc "System configuration schemas"
            = import "./operations/tasks/system_config/main.ncl",
        },
    },

  # ========== DEPLOYMENT ==========
  deployment | doc "Deployment and execution (kubernetes, modes)"
    = {
      kubernetes | doc "Kubernetes deployment schemas"
        = import "./deployment/kubernetes/main.ncl",

      modes | doc "Execution mode schemas (solo, multiuser, cicd, enterprise)"
        = import "./deployment/modes/main.ncl",
    },

  # ========== SERVICES ==========
  services | doc "Platform-specific services (Gitea, etc)"
    = {
      gitea | doc "Gitea service configuration"
        = import "./services/gitea/main.ncl",
    },

  # ========== GENERATOR ==========
  generator | doc "Code generation and declarations"
    = {
      declaration | doc "Workspace declaration schemas for generator"
        = import "./generator/declaration/main.ncl",

      gap | doc "Gap module"
        = import "./generator/gap.ncl",

      change | doc "Change module"
        = import "./generator/change.ncl",
    },

  # ========== INTEGRATIONS ==========
  integrations | doc "External system integrations (runtime, gitops, etc)"
    = {
      runtime | doc "Runtime integration schemas"
        = import "./integrations/runtime.ncl",

      gitops | doc "GitOps integration schemas"
        = import "./integrations/gitops.ncl",

      main | doc "Main integration schemas"
        = import "./integrations/main.ncl",
    },

  # ========== VERSIONING ==========
  version | doc "Version management schemas"
    = import "./version.ncl",
}
