{% extends "_base.html" %}
{% block title %}{{ super() }} {% trans %}Home{% endtrans %} {% endblock %}
{% block body %}

<br/>
<section id="collections">
<div class="row">
  <div class="col-md-8 col-sm-12">

  {% if config['metadata'] and (config['metadata']['identification'] or config['metadata']['license']) %}
  <section id="identification">
    <h1>{{ config['metadata']['identification']['title'] }}</h1>
    <p>{{ config['metadata']['identification']['description'] }}</p>

    <p>
        {% for kw in config['metadata']['identification']['keywords'] %}
          <span class="badge bg-primary text-bg-primary">{{ kw }}</span>
        {% endfor %}
    </p>

    <div class="card bg-light mb-3">
      <div class="card-body">
        {% if config['metadata']['identification']['terms_of_service'] %}
          <div class="row">
              <div class="col-sm-4">
                {% trans %}Terms of service{% endtrans %}
              </div>
              <div class="col-sm-8">
                {{ config['metadata']['identification']['terms_of_service'] | urlize() }}
              </div>
          </div>
        {% endif %}
        {% if config['metadata']['license']['url'] %}
          <div class="row">
              <div class="col-sm-4">
                {% trans %}License{% endtrans %}
              </div>
              <div class="col-sm-8">
                  <a href="{{ config['metadata']['license']['url'] }}">
                    {{ config['metadata']['license']['name'] or config['metadata']['license']['url'] }}</a>
              </div>
          </div>
        {% endif %}
        {% if config['metadata']['identification']['url'] %}
          <div class="row">
              <div class="col-sm-4">
                {% trans %}URL{% endtrans %}
              </div>
              <div class="col-sm-8">
                  <a href="{{ config['metadata']['identification']['url'] }}">
                    {{ config['metadata']['identification']['url'] | truncate( 70 ) }}</a>
              </div>
          </div>
        {% endif %}
      </div>
    </div>
  </section>
  {% endif %}

  {% if data['collection'] %}
  <section id="collections">
    <h2>{% trans %}Collections{% endtrans %}</h2>
    <p>
      <a href="{{ config['server']['url'] }}/collections?f=html">{% trans %}View the collections in this service{% endtrans %}</a>
    </p>
  </section>
 {% endif %}
 {% if data['stac-collection'] %}
  <section id="collections">
    <h2>{% trans %}SpatioTemporal Assets{% endtrans %}</h2>
    <p>
      <a href="{{ config['server']['url'] }}/stac?f=html">{% trans %}View the SpatioTemporal Assets in this service{% endtrans %}</a>
    </p>
  </section>
 {% endif %}
 {% if data['process'] %}
  <section id="processes">
      <h2>{% trans %}Processes{% endtrans %}</h2>
      <p>
        <a href="{{ config['server']['url'] }}/processes?f=html">{% trans %}View the processes in this service{% endtrans %}</a>
      </p>
  </section>
  <section id="jobs">
      <h2>{% trans %}Jobs{% endtrans %}</h2>
      <p>
        <a title="Browse jobs" href="{{config.server.url}}/jobs">{% trans %}Browse jobs{% endtrans %}</a>
      </p>
  </section>
 {% endif %}
  <section id="openapi">
      <h2>{% trans %}API Definition{% endtrans %}</h2>
      <p>
        {% trans %}Documentation{% endtrans %}: <a href="{{ config['server']['url'] }}/api?f=html">{% trans %}Swagger UI{% endtrans %}</a> <a href="{{ config['server']['url'] }}/api?f=html&ui=redoc">{% trans %}ReDoc{% endtrans %}</a>
      </p>
      <p>
        <a href="{{ config['server']['url'] }}/api?f=json">{% trans %}OpenAPI Document{% endtrans %}</a>
      </p>
  </section>
  <section id="conformance">
      <h2>{% trans %}Conformance{% endtrans %}</h2>
      <p>
        <a href="{{ config['server']['url'] }}/conformance?f=html">{% trans %}View the conformance classes of this service{% endtrans %}</a>
      </p>
  </section>
  {% if data['tile'] %}
  <section id="tilematrixsets">
      <h2>{% trans %}Tile Matrix Sets{% endtrans %}</h2>
      <p>
        <a href="{{ config['server']['url'] }}/tileMatrixSets?f=html">{% trans %}View the Tile Matrix Sets available on this service{% endtrans %}</a>
      </p>
  </section>
  {% endif %}
  {% if data['has_dataset_map'] %}
  <section id="dataset_map">
      <h2>{% trans %}Dataset maps{% endtrans %}</h2>
      <p>
        <a href="{{ config['server']['url'] }}/map.png">{% trans %}Default map of the whole dataset (as PNG){% endtrans %}</a>
      </p>
      <p>
        <a href="{{ config['server']['url'] }}/map.jpg">{% trans %}Default map of the whole dataset (as JPEG){% endtrans %}</a>
      </p>
  </section>
  {% endif %}
  {% if data['has_dataset_map'] and data['tile'] %}
  <section id="dataset_tiles">
      <h2>{% trans %}Dataset tilesets{% endtrans %}</h2>
      <p>
        <a href="{{ config['server']['url'] }}/map/tiles?f=html">{% trans %}Default tilesets for the whole dataset (as HTML){% endtrans %}</a>
      </p>
      <p>
        <a href="{{ config['server']['url'] }}/map/tiles?f=json">{% trans %}Default tilesets for the whole dataset (as JSON){% endtrans %}</a>
      </p>
  </section>
  {% endif %}
  </div>
  <div class="col-md-4 col-sm-12">
    {% if config['metadata']['provider'] %}
    <div class="card mb-3">
      <div class="card-header">
       <b>{% trans %}Provider{% endtrans %}</b>
      </div>
      <div class="card-body">
        <b>{{ config['metadata']['provider']['name'] }}</b><br/>
        <a href="{{ config['metadata']['provider']['url'] }}">{{ config['metadata']['provider']['url'] }}</a><br/>
      </div>
    </div>
    {% endif %}
    {% if config['metadata']['contact'] %}
    <div class="card">
      <div class="card-header">
          <b>{% trans %}Contact point{% endtrans %}</b>
      </div>
      <div class="card-body">
        <b>{% trans %}Address{% endtrans %}</b><br/>
        <div class="section">
          <span>{{ config['metadata']['contact']['name'] }}</span><br/>
          {% for key in ['address', 'city', 'stateorprovince', 'postalcode', 'country'] %}
             {% if key in config['metadata']['contact'] %}
             <span>{{ config['metadata']['contact'][key] }}</span><br/>
             {% endif %}
          {% endfor %}
        </div>
        <div>
          {% if config['metadata']['contact']['email'] %}
            <b>{% trans %}Email{% endtrans %}</b><br/>
            <span><a href="mailto:{{ config['metadata']['contact']['email'] }}">{{ config['metadata']['contact']['email'] }}</a></span><br/>
          {% endif %}
          {% if config['metadata']['contact']['phone'] %}
            <b>{% trans %}Telephone{% endtrans %}</b><br/>
            <span><a href="tel:{{ config['metadata']['contact']['phone'] }}">{{ config['metadata']['contact']['phone'] }}</a></span><br/>
          {% endif %}
          {% if config['metadata']['contact']['fax'] %}
            <b>{% trans %}Fax{% endtrans %}</b><br/>
            <span><a href="tel:{{ config['metadata']['contact']['fax'] }}">{{ config['metadata']['contact']['fax'] }}</a></span><br/>
          {% endif %}
          {% if config['metadata']['contact']['url'] %}
            <b>{% trans %}Contact URL{% endtrans %}</b><br/>
            <span><a href="{{ config['metadata']['contact']['url'] }}">{{ config['metadata']['contact']['url'] }}</a></span><br/>
          {% endif %}
          {% if config['metadata']['contact']['hours'] %}
            <b>{% trans %}Hours{% endtrans %}</b><br/>
            <span>{{ config['metadata']['contact']['hours'] }}</span><br/>
          {% endif %}
          {% if config['metadata']['contact']['instructions'] %}
            <b>{% trans %}Contact instructions{% endtrans %}</b><br/>
            <span>{{ config['metadata']['contact']['instructions'] }}</span>
          {% endif %}
        </div>
      </div>
    </div>
    {% endif %}
  </div>
</div>

</section>

{% endblock %}
