# Produces:
# -----------------------------
#   Generates 2 Sections for each Version of a published template and 4 Sections for 
#   each Version of an unpublished template 
#   (see dmptemplates.yml, phases.yml and versions.yml)
#
# [template]_phase_1_version_1_section_[1..2]
# [template]_unpublished_phase_[1..2]_version_[1..2]_section_[1..4]
#
#   The complete organisation has 2 sections attached to its template and 2 
#   customisations
#
# complete_customised_template_phase_1_version_1_section_[1..2]
#

# Import versions.yml so that we can dynamically generate sections
<% versions = YAML::load(ERB.new(File.read('./test/fixtures/versions.yml')).result) %>

<% versions.each do |lbl, hash| %>
  <% if lbl.include?('customised_') %>

    <% 2.times do |n| %>
<%= lbl %>_customisation_<%= n + 1 %>:
  title: <%= "#{(n == 0) ? 'Licensing (Customisation)' : 'Access (Customisation)'}" %>
  number: <%= 3 + n %>
  version: <%= lbl %>
  organisation: complete
    <% end %>

  <% else %>

    <% 2.times do |x| %>
<%= lbl %>_section_<%= x + 1 %>:
  title: <%= "#{(x == 0) ? 'Data Collection' : 'Storage and Backup'}" %>
  number: <%= x + 1 %>
  version: <%= lbl %>
    <% end %>

    <% if lbl.include?('_unpublished') %>
      <% 2.times do |y| %>
<%= lbl %>_section_<%= y + 3 %>:
  title: <%= "#{(y == 0) ? 'Documentation' : 'Compliance'}" %>
  number: <%= 3 + y %>
  version: <%= lbl %>
      <% end %>
    <% end %>
  <% end %>
<% end %>
