# VAPORA Main Configuration Schema - Unified service configuration

let backend_schema = import "./backend.ncl" in
let agents_schema = import "./agents.ncl" in
let llm_router_schema = import "./llm-router.ncl" in

{
  deployment_mode | String | doc "Deployment profile: solo, multiuser, enterprise" | default = "solo",
  workspace_name | String | doc "Workspace name for multi-tenant" | default = "vapora-workspace",

  backend | backend_schema,

  agents | agents_schema,

  llm_router | llm_router_schema,

  frontend = {
    host | String | doc "Frontend server bind address" | default = "0.0.0.0",
    port | Number | doc "Frontend server port" | default = 3000,
    api_url | String | doc "Backend API URL as seen from frontend" | default = "http://localhost:8001",
    enable_wasm | Bool | doc "Enable WASM compilation for frontend" | default = true,
  },

  database = {
    url | String | doc "SurrealDB connection URL" | default = "ws://localhost:8000",
    username | String | doc "SurrealDB username" | default = "root",
    password | String | doc "SurrealDB password" | default = "",
    database | String | doc "Database name" | default = "vapora",
    pool_size | Number | doc "Connection pool size" | default = 20,
  },

  nats = {
    enabled | Bool | doc "Enable NATS JetStream for distributed coordination" | default = false,
    url | String | doc "NATS server URL" | default = "nats://localhost:4222",
    timeout | Number | doc "NATS connection timeout in seconds" | default = 60,
  },

  providers = {
    claude_enabled | Bool | doc "Enable Claude (Anthropic)" | default = true,
    openai_enabled | Bool | doc "Enable OpenAI" | default = false,
    gemini_enabled | Bool | doc "Enable Google Gemini" | default = false,
    ollama_enabled | Bool | doc "Enable Ollama (local)" | default = false,
    ollama_url | String | doc "Ollama server URL" | default = "http://localhost:11434",
  },

  monitoring = {
    prometheus_enabled | Bool | doc "Enable Prometheus metrics" | default = false,
    log_level | String | doc "Log level: trace, debug, info, warn, error" | default = "info",
    tracing_enabled | Bool | doc "Enable distributed tracing" | default = false,
    metrics_path | String | doc "Prometheus metrics endpoint path" | default = "/metrics",
  },

  security = {
    jwt_secret | String | doc "JWT signing secret" | default = "",
    tls_enabled | Bool | doc "Enable TLS for all services" | default = false,
    tls_cert_path | String | doc "Path to TLS certificate" | default = "/etc/vapora/certs/tls.crt",
    tls_key_path | String | doc "Path to TLS private key" | default = "/etc/vapora/certs/tls.key",
  },

  storage = {
    base_path | String | doc "Base path for all service storage" | default = "/var/lib/vapora",
    backup_enabled | Bool | doc "Enable automated backups" | default = true,
    backup_interval | Number | doc "Backup interval in hours" | default = 24,
  },
}
