{% extends "passerelle/manage/service_view.html" %}
{% load i18n passerelle %}

{% block description %}
  <p>
    {% blocktrans trimmed %}
      This API provides an access to <a href="https://www.okina.fr/">Okina</a> API.
    {% endblocktrans %}
    <ul>
      <li>{% trans "Service URL:" %} {{ object.service_url }}</li>
    </ul>
  </p>
{% endblock %}

{% block endpoints %}
  <h4>{% trans 'General' %}</h4>
  <ul class="endpoints">
    <li class="get-method"><div class="description"><span class="description--label">{% trans 'Cities:' %}</span> <a class="example-url" href="cities/"
    >{{ site_base_uri }}{{ object.get_absolute_url }}cities</a></div></li>
    <li class="get-method"><div class="description"><span class="description--label">{% trans 'Classes:' %}</span><a class="example-url" href="classes/"
    >{{ site_base_uri }}{{ object.get_absolute_url }}classes</a></div></li>
    <li class="get-method"><div class="description"><span class="description--label">{% trans 'Institutions:' %}</span>
      <a class="example-url" href="institutions/"
      >{{ site_base_uri }}{{ object.get_absolute_url }}institutions</a></div></li>
  </ul>

  <h4>{% trans 'Journeys' %}</h4>
  <ul class="endpoints">
    <li class="get-method"><div class="description"><span class="description--label">{% trans 'Get stop points based on a starting position and an arrival institution (API 2020)' %}</span>
      <a class="example-url" href="search?lat=46.828652&lon=1.701463&institution=277"
      >{{ site_base_uri }}{{ object.get_absolute_url }}search?lat=...&lon=...&institution=<i>institution_id</i></a></div></li>

    <li class="get-method"><div class="description"><span class="description--label">{% trans 'Institutions in a city (API 2020)' %}</span>
      <a class="example-url" href="institutions?insee=36005"
      >{{ site_base_uri }}{{ object.get_absolute_url }}institutions?insee=<i>city-insee-code</i></a></div></li>

    <li class="get-method"><div class="description"><span class="description--label">{% trans 'Institutions accessible from a city:' %}</span>
      <a class="example-url" href="institutions/from-city/36005/"
      >{{ site_base_uri }}{{ object.get_absolute_url }}institutions/from-city/<i>city-insee-code</i>/</a></div></li>

    <li class="get-method"><div class="description"><span class="description--label">{% trans 'Stop areas from a city to an institution:' %}</span>
      <a class="example-url" href="stop-areas/from-city/36005/to-institution/276/"
      >{{ site_base_uri }}{{ object.get_absolute_url }}stop-areas/from-city/<i>city-insee-code</i>/to-institution/<i>institution_id</i>/</a></div></li>

    <li class="get-method"><div class="description"><span class="description--label">{% trans 'Origin/Destinations:' %}</span><a class="example-url" href="origin-destinations/"
    >{{ site_base_uri }}{{ object.get_absolute_url }}origin-destinations</a></div></li>
    <li class="get-method"><div class="description"><span class="description--label">{% trans 'Origin/Destinations to an institution:' %}</span>
      <a class="example-url" href="origin-destinations/to-institution/276/"
      >{{ site_base_uri }}{{ object.get_absolute_url }}origin-destinations/to-institution/<i>institution_id</i>/</a></div></li>
    <li class="get-method"><div class="description"><span class="description--label">{% trans 'Origin/Destinations from a stop area to an institution:' %}</span>
      <a class="example-url" href="origin-destinations/from-stop-area/3282/to-institution/276/"
      >{{ site_base_uri }}{{ object.get_absolute_url }}origin-destinations/from-stop-area/<i>stop_area_id</i>/to-institution/<i>institution_id</i>/</a></div></li>
    <li class="get-method"><div class="description"><span class="description--label">{% trans 'Origin/Destinations from a city to an institution:' %}</span>
      <a class="example-url" href="origin-destinations/from-city/36005/to-institution/276/"
      >{{ site_base_uri }}{{ object.get_absolute_url }}origin-destinations/from-city/<i>city_insee_code</i>/to-institution/<i>institution_id</i></a></div></li>
    <li class="get-method"><div class="description"><span class="description--label">{% trans 'Origin/Destinations from a city:' %}</span>
      <a class="example-url" href="origin-destinations/from-city/36005/"
      >{{ site_base_uri }}{{ object.get_absolute_url }}origin-destinations/from-city/<i>city_insee_code</i>/</a></div></li>
  </ul>

  <h4>{% trans 'Subscriptions' %}</h4>
  <ul class="endpoints">
    <li class="post-method"><div class="description"><span class="description--label">{% trans 'Create a subscriber:' %}</span>
      <a class="example-url" href="subscriber/"
      >{{ site_base_uri }}{{ object.get_absolute_url }}subscriber/</a></div>
      <div class="body-schemas">{% trans 'Same payload as for the Okina POST /b2b/subscribers endpoint' %}</div></li>
    <li class="get-method"><div class="description"><span class="description--label">{% trans 'Informations about a subscriber:' %}</span>
      <a class="example-url" href="subscriber/284/"
      >{{ site_base_uri }}{{ object.get_absolute_url }}subscriber/<i>id</i>/</a></div></li>
    <li class="get-method"><div class="description"><span class="description--label">{% trans "Get subscriber's QR Code:" %}</span>
      <a class="example-url" href="subscriber/284/qrcode/"
      >{{ site_base_uri }}{{ object.get_absolute_url }}subscriber/<i>id</i>/qrcode/</a></div></li>
    <li class="post-method"><div class="description"><span class="description--label">{% trans 'Create a subscription:' %}</span>
      <a class="example-url" href="subscription/"
      >{{ site_base_uri }}{{ object.get_absolute_url }}subscription/</a></div>
      <div class="body-schemas">{% trans 'Same payload as for the Okina POST /b2b/subscriptions endpoint' %}</div></li>
    <li class="get-method"><div class="description"><span class="description--label">{% trans 'Informations about a subscription:' %}</span>
      <a class="example-url" href="subscription/283/"
      >{{ site_base_uri }}{{ object.get_absolute_url }}subscription/<i>id</i>/</a></div></li>
  </ul>


  <h4>{% trans 'Topology' %}</h4>
  <ul class="endpoints">
    <li class="get-method"><div class="description"><span class="description--label">{% trans 'Lines:' %}</span><a class="example-url" href="topology/lines/"
    >{{ site_base_uri }}{{ object.get_absolute_url }}topology/lines/</a></div></li>
    <li class="get-method"><div class="description"><span class="description--label">{% trans 'Networks:' %}</span><a class="example-url" href="topology/networks/"
    >{{ site_base_uri }}{{ object.get_absolute_url }}topology/networks/</a></div></li>
    <li class="get-method"><div class="description"><span class="description--label">{% trans 'Vehicle journeys:' %}</span><a class="example-url" href="topology/vehicle-journeys/"
    >{{ site_base_uri }}{{ object.get_absolute_url }}topology/vehicle-journeys/</a></div></li>
  </ul>

{% endblock %}

{% block security %}
  <p>
    {% trans 'Access to subscription endpoints is limited to the following API users:' %}
  </p>
  {% access_rights_table resource=object permission='can_access' %}
{% endblock %}
