# Example Nickel template for TypeDialog metaprogramming
#
# This template demonstrates dynamic Nickel code generation using
# form results and Jinja2 template syntax.
#
# Usage: typedialog nickel-template template.ncl.j2 results.json -o output.ncl

# Generated Nickel configuration from form results
{
  app = {
    name : String = "{{ app_name }}",
    version : String = "{{ app_version }}",
    {%- if app_environment %}
    environment : String = "{{ app_environment }}",
    {%- endif %}
  },

  server = {
    host : String = "{{ server_host }}",
    port : Number = {{ server_port }},
    {%- if server_workers %}
    workers : Number = {{ server_workers }},
    {%- endif %}
  },

  database = {
    url : String = "{{ database_url }}",
    {%- if database_pool_size %}
    pool_size : Number = {{ database_pool_size }},
    {%- endif %}
  },

  {%- if tls_enabled %}
  tls = {
    enabled : Bool = {{ tls_enabled }},
    {%- if tls_cert_path %}
    cert_path : String = "{{ tls_cert_path }}",
    {%- endif %}
    {%- if tls_key_path %}
    key_path : String = "{{ tls_key_path }}",
    {%- endif %}
  },
  {%- endif %}

  features = {
    {%- if features_monitoring %}
    monitoring : Bool = {{ features_monitoring }},
    {%- endif %}
    {%- if features_caching %}
    caching : Bool = {{ features_caching }},
    {%- endif %}
    {%- if features_cors %}
    cors : Bool = {{ features_cors }},
    {%- endif %}
  },
}
