{% extends "yes-no.njk" %}
{% from "answer-summary.njk" import answerSummary %}

{% if data.contacts.length === 0 %}
    {% set title = 'Do you want to add an authorised person?' %}
{% else %}
    {% set title = 'Check your answers' %}
{% endif %}

{% set noneSelected = 'Choose yes if you want to add an authorised person' %}

{% block pageContent %}

{% if data.contacts.length !== 0 %}
    {% for contact in data.contacts %}
        <h2 class="govuk-heading-m">Authorised person</h2>
        <p class="govuk-body" />
            <a class="govuk-link govuk-link--no-visited-state" href="{{ contact.uri.remove }}">Remove</a>
        </p>
        {% set questionMap = {
            name: { question: 'Name', href: contact.uri.name },
            email: { question: 'Email address', href: contact.uri.email },
            address: { question: 'Contact address', href: contact.uri.address }
        } %}
        {{ answerSummary(questionMap, contact.details) }}
    {% endfor %}
    <h2 class="govuk-heading-m">Do you want to add another authorised person?</h2>
{% else %}
    <p class="govuk-body-m">This is a person who will be responsible for everything done under the licence.</p>
    <p class="govuk-body-m">It does not include any assistants who will work under the direct supervision of the licence holder or any authorised people.</p>
{% endif %}

{{ super() }}
{% endblock %}
