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

{% block description %}
  <p>
    Server: {{ object.server }}
  </p>
{% endblock %}

{% block endpoints %}
  <ul class="endpoints">
    <li class="get-method">
      <div class="description"><span class="description--label">{% trans 'Listing all sets:' %}</span>
        {% url 'generic-endpoint' connector="clicrdv" slug=object.slug endpoint="interventionsets" slug=object.slug as interventionsets_url %}
        <a class="example-url" href="{{ interventionsets_url }}">{{ site_base_uri }}{{ interventionsets_url }}</a></div>
    </li>
    <li class="get-method">
      <div class="description"><span class="description--label">{% trans 'Listing interventions in a set:' %}</span>
        <a class="example-url" href="{{ interventionsets_url }}">{{ site_base_uri }}{{ interventionsets_url }}/<i>&lt;set_id&gt;</i></a></div>
    </li>
    <li class="get-method">
      {% url 'clicrdv-view' slug=object.slug as view_url %}
      <div class="description"><span class="description--label">{% trans 'Listing of free dates and times for an intervention:' %}</span>
        <a class="example-url">{{ site_base_uri }}{{ view_url }}interventions/<i>&lt;intervention_id&gt;</i>/datetimes</a></a></div>
  </li>
  <li class="get-method">
    <div class="description"><span class="description--label">{% trans 'Listing of free dates for an intervention:' %}</span>
      <a class="example-url">{{ site_base_uri }}{{ view_url }}interventions/<i>&lt;intervention_id&gt;</i>/dates</a></div>
  </li>
  <li class="get-method">
    <div class="description"><span class="description--label">{% trans 'Listing of free times a given date for an intervention:' %}</span>
      <a class="example-url">{{ site_base_uri }}{{ view_url }}interventions/<i>&lt;intervention_id&gt;</i>/<i>&lt;date&gt;</i></a></div>
  </li>
  <li class="post-method">
    {% url 'clicrdv-create-appointment-qs' slug=object.slug as create_appointment_url %}
    <div class="description"><span class="description--label">{% trans 'Creating a new appointment:' %}</span>
      <a class="example-url" href="{{ create_appointment_url }}">{{ site_base_uri }}{{ create_appointment_url }}</a></div>
  </li>
  <li class="get-method">
    {% url 'clicrdv-cancel-appointment' slug=object.slug appointment_id='000' as appointment_cancel_url %}
    <div class="description"><span class="description--label">{% trans 'Cancelling an appointment:' %}</span>
      <a class="example-url">{{ site_base_uri }}{{ view_url }}<i>&lt;appointment_id&gt;</i>/cancel</a></div>
  </li>
  </ul>
{% endblock %}

{% block security %}
  <p>
    {% trans 'Accessing the listings is open, but creation and cancellation of appointments requests is limited to the following API users:' %}
  </p>

  {% access_rights_table resource=object permission='can_manage_appointment' %}
{% endblock %}
