{% set default_days_offset = 1 %}
{% for template in yaml_templates %}
  {% for obj in template %}
    - unit_of_work: "{{ obj.unit_of_work }}"
      schedule: "{{ obj.schedule }}"
      {% if obj.frequency %}frequency: {{ obj.frequency }}{% endif %}
      {% if obj.data_source %}data_source: {{ obj.data_source }}{% endif %}
      args:
        dsp: {{ obj.args.dsp }}
        report_type: {% if obj.args.dsp.startswith("amazon") %}amazon_{{ obj.args.report_type }}{% elif obj.args.dsp.startswith("gras") %}{{ obj.args.report_type }}{% else %}{{ obj.args.dsp }}_{{ obj.args.report_type }}{% endif %}
        unit_type: {{ obj.args.unit_type }}
        {% if obj.args.dbx_job_id %}dbx_job_id: {{ obj.args.dbx_job_id }}{% endif %}
        {% if obj.args.dbx_job_max_lifetime %}dbx_job_max_lifetime: {{ obj.args.dbx_job_max_lifetime }}{% endif %}
        {% if obj.args.dbx_spark_params %}dbx_spark_params: {{ obj.args.dbx_spark_params }}{% endif %}
        valid_from: "{{ obj.args.valid_from }}"
        {% if obj.args.valid_until %}valid_until: "{{ obj.args.valid_until }}"{% endif %}
        {% if obj.args.include_on_hold %}include_on_hold: {{ obj.args.include_on_hold }}{% endif %}
        days_offset: {% if obj.args.days_offset == 0 or obj.args.days_offset %}{{ obj.args.days_offset }}{% else %}{{ default_days_offset }}{% endif %}
        {% if obj.args.dependencies_type %}dependencies_type: {{ obj.args.dependencies_type }}{% endif %}
        {% if obj.args.uow_active_days_limit %}uow_active_days_limit: {{ obj.args.uow_active_days_limit }}{% endif %}
    {% if obj.dependencies %}
      dependencies:
      {% for dependency in obj.dependencies %}
        - name: "{{ dependency.name }}"
          {% if dependency.type %}type: {{ dependency.type }}{% endif %}
          {% if dependency.is_single_context == true %}is_single_context: true{% endif %}
          {% if dependency.is_single_context == false %}is_single_context: false{% endif %}
          {% if dependency.is_optional %}is_optional: {{ dependency.is_optional }}{% endif %}
          {% if dependency.frequency %}frequency: {{ dependency.frequency }}{% endif %}
          {% if dependency.days_offset %}days_offset: {{ dependency.days_offset }}{% endif %}
      {% endfor %}
    {% endif %}
  {% endfor %}
{% endfor %}
