# Orchestrator Service Default Configuration
# Workflow engine defaults with queue, batch, extensions

let orchestrator_schema = import "../schemas/orchestrator.ncl" in
let monitoring_defaults = import "./common/monitoring-defaults.ncl" in
let logging_defaults = import "./common/logging-defaults.ncl" in

{
  orchestrator | orchestrator_schema.OrchestratorConfig = {
    # Workspace Configuration
    workspace = {
      name = "default",
      path = "/var/lib/provisioning/orchestrator",
      enabled = true,
      multi_workspace = false,
    },

    # HTTP Server Settings
    server = {
      host = "127.0.0.1",
      port = 9090,
      workers = 4,
      keep_alive = 75,
      max_connections = 100,
      request_timeout = 30000,
      graceful_shutdown = true,
      shutdown_timeout = 30,
    },

    # Storage Configuration
    storage = {
      backend = "filesystem",
      path = "/var/lib/provisioning/orchestrator/data",
      cache = {
        enabled = true,
        type = "in_memory",
        eviction_policy = "lru",
        ttl = 3600,
      },
    },

    # Queue Configuration
    queue = {
      max_concurrent_tasks = 5,
      retry_attempts = 3,
      retry_delay = 5000,
      task_timeout = 3600000,
      persist = true,
      dead_letter_queue = {
        enabled = true,
        max_size = 1000,
      },
      priority_queue = false,
      metrics = false,
    },

    # Batch Workflow Configuration
    batch = {
      parallel_limit = 5,
      operation_timeout = 1800000,
      checkpointing = {
        enabled = true,
        interval = 100,
        max_checkpoints = 10,
      },
      rollback = {
        enabled = true,
        strategy = "checkpoint_based",
        max_rollback_depth = 5,
      },
      metrics = false,
    },

    # Extensions Configuration
    extensions = {
      auto_load = false,
      discovery_interval = 300,
      max_concurrent = 5,
      timeout = 30000,
      sandbox = true,
    },

    # Monitoring Configuration
    monitoring = monitoring_defaults.monitoring,

    # Logging Configuration
    logging = logging_defaults.logging,
  },
}
