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

let ai_service_schema = import "../schemas/ai-service.ncl" in

{
  ai_service | ai_service_schema.AiServiceConfig = {
    # Server Configuration
    server = {
      {%- if server_host %}
      host = "{{ server_host }}",
      {%- endif %}
      {%- if server_port %}
      port = {{ server_port }},
      {%- endif %}
      {%- if server_workers %}
      workers = {{ server_workers }},
      {%- endif %}
    },

    # RAG Integration Configuration
    {{%- if rag_enabled is defined %}
    rag = {
      enabled = {{ rag_enabled | lower }},
      {%- if rag_service_url %}
      rag_service_url = "{{ rag_service_url }}",
      {%- endif %}
      {%- if rag_timeout %}
      timeout = {{ rag_timeout }},
      {%- endif %}
    },
    {%- endif %}

    # MCP Integration Configuration
    {%- if mcp_enabled is defined %}
    mcp = {
      enabled = {{ mcp_enabled | lower }},
      {%- if mcp_service_url %}
      mcp_service_url = "{{ mcp_service_url }}",
      {%- endif %}
      {%- if mcp_timeout %}
      timeout = {{ mcp_timeout }},
      {%- endif %}
    },
    {%- endif %}

    # DAG Workflow Configuration
    {%- if dag_max_concurrent_tasks or dag_task_timeout %}
    dag = {
      {%- if dag_max_concurrent_tasks %}
      max_concurrent_tasks = {{ dag_max_concurrent_tasks }},
      {%- endif %}
      {%- if dag_task_timeout %}
      task_timeout = {{ dag_task_timeout }},
      {%- endif %}
      {%- if dag_retry_attempts %}
      retry_attempts = {{ dag_retry_attempts }},
      {%- endif %}
    },
    {%- endif %}

    # Logging Configuration (optional)
    {%- if logging_level %}
    logging = {
      level = "{{ logging_level }}",
      {%- if logging_format %}
      format = "{{ logging_format }}",
      {%- 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 %}
  },
}
