<h3>Reserved Instances Report</h3>
<hr>
{% for service in report %}
    <p><strong>Below is the report on {{ service }} reserved instances:</strong></p>
    {% if report[service]['unused_reservations'] %}
      <table>
        <thead>
          <th>Used/Unused</th>
          <th>Count</th>
          <th>Type</th>
          <th>AZ</th>
          <th>Details</th>
        </thead>
        {% for type, count in report[service]['unused_reservations'].items() %}
          <tr>
            <td>UNUSED RESERVATION!</td>
            <td>{{ count }}</td>
            <td>{{ type[0] }}</td>
            <td>{{ type[1] }}</td>
            <td>
              {% if reserve_expiry %}
                Expires in {{ reserve_expiry[type]|string }} days.
              {% endif %}
            </td>
          </tr>
        {% endfor %}
      </table>
    {% else %}
      <p>You have no unused {{ service }} reservations.</p>
    {% endif %}
    {% if report[service]['unreserved_instances'] %}
      <table>
        <thead>
          <th>Used/Unused</th>
          <th>Count</th>
          <th>Type</th>
          <th>AZ</th>
          <th>Details</th>
        </thead>
        {% for type, count in report[service]['unreserved_instances'].items() %}
          <tr>
            <td>NOT RESERVED!</td>
            <td>{{ count }}</td>
            <td>{{ type[0] }}</td>
            <td>{{ type[1] }}</td>
            <td>
              {% if instance_ids %}
                {{ ", ".join(instance_ids[type]) }}
              {% endif %}
            </td>
          </tr>
        {% endfor %}
      </table>
    {% else %}
      <p>You have no unreserved {{ service }} instances.</p>
    {% endif %}
    <p>({{ report[service]['qty_running_instances'] }}) running on-demand {{ service }} instances</p>
    <p>({{ report[service]['qty_reserved_instances'] }}) {{ service }} reservations</p>
    <p>({{ report[service]['qty_unreserved_instances'] }}) Unreserved {{ service }} reservations</p>
{% endfor %}
