{% extends "standard-form.njk" %}
{% from "radios/macro.njk" import govukRadios %}
{% set title = 'Who is responsible for paying the invoice?' %}

{% set errorMap = {
        'responsible': {
            'any.required': { ref: '#responsible', text: 'You have not selected an option' }
        }
    }
%}

{% block pageContent %}
    {{ govukRadios({
      idPrefix: "responsible",
      name: "responsible",
      errorMessage: {
        text: 'Select an option'
      } if error['responsible'] === 'any.required',
      items: [
        {
          value: "applicant",
          text: data.applicantName + ", the applicant",
          checked: data.currentPayer === 'applicant'
        },
        {
          value: "ecologist",
          text: data.ecologistName + ", the ecologist",
          checked: data.currentPayer === 'ecologist'
        },
        {
          divider: "or"
        },
        {
          value: "other",
          text: "Somebody else",
          checked: data.currentPayer === 'other'
        }
      ]
    }) }}
{% endblock %}
