{# {{ project_name }} - Nickel Configuration Template (Jinja2) #}
{# Generated by typedialog-prov-gen #}
{# This template is rendered by infrastructure tools (Ansible, Terraform) #}
{# to produce final Nickel configuration files #}

# {{ project_name }} Configuration
# Generated from template at: {{ "{{" }} template_generation_time {{ "}}" }}
# Environment: {{ "{{" }} environment {{ "}}" }}

let schemas = import "./schemas/config.ncl" in
let defaults = import "./defaults/config.ncl" in

{
{% for feature in features %}
  # {{ feature.name }} configuration
  {{ feature.name }} = {
  {% for field in feature.fields %}
    {% if field.field_type == "Text" or field.field_type == "Password" %}
    {{ field.name }} = "{{ "{{" }} {{ feature.name }}_{{ field.name }} {{ "}}" }}",
    {% elif field.field_type == "Number" %}
    {{ field.name }} = {{ "{{" }} {{ feature.name }}_{{ field.name }} {{ "}}" }},
    {% elif field.field_type == "Confirm" %}
    {{ field.name }} = {{ "{{" }} {{ feature.name }}_{{ field.name }} | lower {{ "}}" }},
    {% elif field.field_type == "Select" %}
    {{ field.name }} = "{{ "{{" }} {{ feature.name }}_{{ field.name }} {{ "}}" }}",
    {% elif field.field_type == "MultiSelect" %}
    {{ field.name }} = {{ "{{" }} {{ feature.name }}_{{ field.name }} | to_json {{ "}}" }},
    {% elif field.field_type == "RepeatingGroup" %}
    {{ field.name }} = {{ "{{" }} {{ feature.name }}_{{ field.name }} | to_json {{ "}}" }},
    {% else %}
    {{ field.name }} = "{{ "{{" }} {{ feature.name }}_{{ field.name }} {{ "}}" }}",
    {% endif %}
  {% endfor %}
  },

{% endfor %}
} | schemas.Config
