# Provisioning Daemon Configuration - Nickel Format
# Auto-generated by provisioning TypeDialog
# Edit via: nu provisioning/.typedialog/provisioning/platform/scripts/configure.nu provisioning-daemon {mode}
# Or manually edit and validate with: nickel typecheck

let daemon_schema = import "../schemas/provisioning-daemon.ncl" in

{
  provisioning_daemon | daemon_schema.ProvisioningDaemonConfig = {
    # Daemon Configuration
    daemon = {
      {{%- if daemon_enabled is defined %}
      enabled = {{ daemon_enabled | lower }},
      {%- endif %}
      {%- if daemon_poll_interval %}
      poll_interval = {{ daemon_poll_interval }},
      {%- endif %}
      {%- if daemon_max_workers %}
      max_workers = {{ daemon_max_workers }},
      {%- endif %}
    },

    # Logging Configuration
    {{%- if logging_level %}
    logging = {
      level = "{{ logging_level }}",
      {%- if logging_file %}
      file = "{{ logging_file }}",
      {%- endif %}
      {%- if logging_format %}
      format = "{{ logging_format }}",
      {%- endif %}
      {%- if logging_syslog is defined %}
      syslog = {{ logging_syslog | lower }},
      {%- endif %}
    },
    {%- endif %}

    # Actions Configuration
    {{%- if actions_auto_cleanup is defined or actions_auto_update is defined %}
    actions = {
      {%- if actions_auto_cleanup is defined %}
      auto_cleanup = {{ actions_auto_cleanup | lower }},
      {%- endif %}
      {%- if actions_auto_update is defined %}
      auto_update = {{ actions_auto_update | lower }},
      {%- endif %}
      {%- if actions_workspace_sync is defined %}
      workspace_sync = {{ actions_workspace_sync | lower }},
      {%- endif %}
      {%- if actions_ephemeral_cleanup is defined %}
      ephemeral_cleanup = {{ actions_ephemeral_cleanup | lower }},
      {%- endif %}
      {%- if actions_health_checks is defined %}
      health_checks = {{ actions_health_checks | lower }},
      {%- endif %}
    },
    {%- endif %}

    # Health Check Configuration
    {{%- if health_check_interval or health_check_timeout %}
    health = {
      {%- if health_check_interval %}
      check_interval = {{ health_check_interval }},
      {%- endif %}
      {%- if health_check_timeout %}
      timeout = {{ health_check_timeout }},
      {%- endif %}
      {%- if health_failure_threshold %}
      failure_threshold = {{ health_failure_threshold }},
      {%- endif %}
    },
    {%- endif %}

    # Worker Pool Configuration
    {{%- if worker_pool_size or worker_task_queue_size %}
    workers = {
      {%- if worker_pool_size %}
      pool_size = {{ worker_pool_size }},
      {%- endif %}
      {%- if worker_task_queue_size %}
      task_queue_size = {{ worker_task_queue_size }},
      {%- endif %}
      {%- if worker_timeout %}
      timeout = {{ worker_timeout }},
      {%- endif %}
    },
    {%- endif %}

    # Monitoring Configuration (optional)
    {%- if monitoring_enabled is defined %}
    monitoring = {
      enabled = {{ monitoring_enabled | lower }},
      {%- if monitoring_metrics_interval %}
      metrics_interval = {{ monitoring_metrics_interval }},
      {%- endif %}
    },
    {%- endif %}
  },
}
