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

let vault_schema = import "../schemas/vault-service.ncl" in

{
  vault_service | vault_schema.VaultServiceConfig = {
    # Server Configuration
    server = {
      {%- if server_host %}
      host = "{{ server_host }}",
      {%- endif %}
      {%- if server_port %}
      port = {{ server_port }},
      {%- endif %}
    },

    # Storage Configuration
    storage = {
      {%- if storage_backend %}
      backend = "{{ storage_backend }}",
      {%- endif %}
      {%- if storage_path %}
      path = "{{ storage_path }}",
      {%- endif %}
      {%- if storage_encryption_key %}
      encryption_key = "{{ storage_encryption_key }}",
      {%- endif %}
    },

    # Deployment Configuration
    deployment = {
      {%- if deployment_mode %}
      mode = "{{ deployment_mode }}",
      {%- endif %}
      {%- if ha_enabled is defined %}
      ha_enabled = {{ ha_enabled | lower }},
      {%- endif %}
    },

    # TLS Configuration
    tls = {
      {%- if tls_verify is defined %}
      verify = {{ tls_verify | lower }},
      {%- endif %}
      {%- if tls_ca_cert_path %}
      ca_cert = "{{ tls_ca_cert_path }}",
      {%- endif %}
      {%- if tls_client_cert_path %}
      client_cert = "{{ tls_client_cert_path }}",
      {%- endif %}
      {%- if tls_client_key_path %}
      client_key = "{{ tls_client_key_path }}",
      {%- endif %}
    },

    # Mount Point Configuration
    mount = {
      {%- if mount_point %}
      path = "{{ mount_point }}",
      {%- endif %}
      {%- if mount_key_name %}
      key = "{{ mount_key_name }}",
      {%- endif %}
    },

    # Authentication Configuration
    {%- if auth_token or auth_method %}
    auth = {
      {%- if auth_method %}
      method = "{{ auth_method }}",
      {%- endif %}
      {%- if auth_token %}
      token = "{{ auth_token }}",
      {%- endif %}
      {%- if auth_role_id %}
      role_id = "{{ auth_role_id }}",
      {%- endif %}
      {%- if auth_secret_id %}
      secret_id = "{{ auth_secret_id }}",
      {%- 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 %}
  },
}
