# Production Platform Configuration
#
# Runtime configuration for production environment
# Optimized for performance, reliability, and scalability

let contracts = import "../../schemas/kb/contracts.ncl" in
let defaults = import "../../schemas/kb/defaults.ncl" in
let helpers = import "../../schemas/kb/helpers.ncl" in
let prod_mode = import "../../schemas/kb/modes/prod.ncl" in

# Production-specific overrides
let prod_platform = {
  graph = {
    name = "knowledge-base-prod",
    description = "Production instance of KB",
  },

  storage = {
    primary = 'filesystem,  # Git-tracked knowledge
    secondary = {
      enabled = true,  # SurrealDB for scalable queries
      type = 'surrealdb,
      url = "ws://surrealdb.production:8000",
      namespace = "kb",
      database = "production",
      # username and password should be set via environment variables
    },
  },

  embeddings = {
    enabled = true,
    provider = 'openai,  # High-quality cloud embeddings
    model = "text-embedding-3-small",
    dimensions = 1536,
    api_key_env = "OPENAI_API_KEY",
  },

  query = {
    similarity_threshold = 0.6,  # Stricter threshold for quality
    max_results = 10,
    recency_weight = 3.0,
    cross_graph = true,
  },

  sync = {
    auto_index = true,  # Auto-sync enabled
    debounce_ms = 300,  # Fast response to changes
    watch_paths = ["notes", "decisions", "guidelines", "patterns", "journal"],
  },

  mcp = {
    server = {
      name = "kb-mcp-prod",
      version = "1.0.0",
      transport = 'stdio,
    },
    tools = {
      search = true,
      add_note = true,
      add_decision = true,
      link = true,
      get_guidelines = true,
      export = true,
    },
    resources = {
      expose_project = true,
      expose_shared = true,
    },
  },
} in

helpers.compose_config defaults.base prod_mode prod_platform
  | contracts.KbConfig
