{% from "govuk/components/table/macro.njk" import govukTable %}
{% from "govuk/components/details/macro.njk" import govukDetails %}

{% macro dprMyReportsListHelp(type) %}

  {% set mainBookmarkHelpHtml %}
    <p class="govuk-body">Bookmarking allows you curate a list of your most used reports for easy access.</p>
    <p class="govuk-body">
      Add bookmarks by clicking the "Add bookmark" link next to a report in the catalogue, or in the report view.
    </p>
  {% endset -%}


  {% set mainRequestedHelpHtml %}
    <p class="govuk-body">List of reports that have been requested</p>
  {% endset -%}


  {% set mainViewedHelpHtml %}
    <p class="govuk-body">List of reports that have been recently viewed</p>
  {% endset -%}


  {% set mainSubsHelpHtml %}
    <p class="govuk-body">List of your report subscriptions</p>
  {% endset -%}


  {% set productHelpHtml %}
    <h3 class="govuk-heading-s govuk-!-margin-bottom-1">Product</h3>
    <p class="govuk-body">Report and variant name information, including type and date information</p>
  {% endset -%}


  {% set filtersHelpHtml %}
    <h3 class="govuk-heading-s govuk-!-margin-bottom-1">Filters</h3>
    <p class="govuk-body">The filters that have been applied to the report as a request filter</p>
  {% endset -%}


  {% set filtersViewedHelpHtml %}
    <h3 class="govuk-heading-s govuk-!-margin-bottom-1">Filters</h3>
    <p class="govuk-body">
      The filters that have been applied to the report as a request filter (in grey), and as an interactive filter (in
      blue):
    </p>
    <ul class="dpr-card-group__item__filters-list">
      <li class="govuk-body-s dpr-query-summary"><strong>Pre request filter:</strong> Value</li>
      <li class="govuk-body-s dpr-interactive-query-summary"><strong>Interactive filter:</strong> Value</li>
    </ul>
    <br /><br />
  {% endset -%}


  {% set statusHelpHtml %}
    <h3 class="govuk-heading-s govuk-!-margin-bottom-1">Status</h3>
    <p class="govuk-body">The current status of a report:</p>
    <ul>
      <li class="govuk-!-margin-bottom-1">
        <strong class="govuk-tag dpr-request-status-tag govuk-tag--green">READY</strong> - the report has loaded and can
        be viewed
      </li>
      <li class="govuk-!-margin-bottom-1">
        <strong class="govuk-tag dpr-request-status-tag govuk-tag--grey">EXPIRED</strong> - the report has expired and
        needs to be refreshed to be viewed
      </li>
      <li class="govuk-!-margin-bottom-1">
        <strong class="govuk-tag dpr-request-status-tag govuk-tag--red">FAILED</strong> - the report has failed to load
      </li>
      <li class="govuk-!-margin-bottom-1">
        <strong class="govuk-tag dpr-request-status-tag govuk-tag--orange">ABORTED</strong> - the report request was
        aborted and can be retried
      </li>
    </ul>
  {% endset -%}


  {% set statusViewedHelpHtml %}
    <h3 class="govuk-heading-s govuk-!-margin-bottom-1">Status</h3>
    <p class="govuk-body">The current status of a report:</p>
    <ul>
      <li class="govuk-!-margin-bottom-1">
        <strong class="govuk-tag dpr-request-status-tag govuk-tag--green">READY</strong> - the report has loaded and can
        be viewed
      </li>
      <li class="govuk-!-margin-bottom-1">
        <strong class="govuk-tag dpr-request-status-tag govuk-tag--grey">EXPIRED</strong> - the report has expired and
        needs to be refreshed to be viewed
      </li>
    </ul>
  {% endset -%}


  {% set actionsHelpHtml %}
    <h3 class="govuk-heading-s govuk-!-margin-bottom-1">Actions:</h3>
    <p class="govuk-body">The actions available for the report</p>
    <ul>
      <li class="govuk-!-margin-bottom-1"><strong>Go to report/dashboard:</strong> View the report/dashboard</li>
      <li class="govuk-!-margin-bottom-1">
        <strong>Refresh:</strong> Navigates the to request page with pre-filled existing filters to make a new request
      </li>
      <li class="govuk-!-margin-bottom-1"><strong>Remove:</strong> Removes the report from the list</li>
      <li class="govuk-!-margin-bottom-1">
        <strong>Retry:</strong> Navigates the to request page with pre-filled existing filters to make a new request
      </li>
    </ul>
  {% endset -%}


  {% set actionsViewedHelpHtml %}
    <h3 class="govuk-heading-s govuk-!-margin-bottom-1">Actions:</h3>
    <p class="govuk-body">The actions available for the report</p>
    <ul>
      <li class="govuk-!-margin-bottom-1"><strong>Go to report/dashboard:</strong> View the report/dashboard</li>
      <li class="govuk-!-margin-bottom-1">
        <strong>Refresh:</strong> Navigates the to request page with pre-filled existing filters to make a new request
      </li>
      <li class="govuk-!-margin-bottom-1"><strong>Remove:</strong> Removes the report from the list</li>
    </ul>
  {% endset -%}

  {% set actionsSubsHelpHtml %}
    <h3 class="govuk-heading-s govuk-!-margin-bottom-1">Actions:</h3>
    <p class="govuk-body">The actions available for the report</p>
    <ul>
      <li class="govuk-!-margin-bottom-1"><strong>Go to report/dashboard:</strong> View the report/dashboard</li>
      <li class="govuk-!-margin-bottom-1">
        <strong>Unsubscribe:</strong> Unsubscribes from the report/dashboard and removes from the list
      </li>
    </ul>
  {% endset -%}


  {% set descriptionHelpHtml %}
    <h3 class="govuk-heading-s govuk-!-margin-bottom-1">Description:</h3>
    <p class="govuk-body">The report/variant description</p>
  {% endset -%}


  {% set actionsHelpBMHtml %}
    <h3 class="govuk-heading-s govuk-!-margin-bottom-1">Actions:</h3>
    <p class="govuk-body">The actions available for the report</p>
    <ul>
      <li class="govuk-!-margin-bottom-1">
        <strong>Request report/dashboard:</strong> Navigates the to request page with pre-filled existing filters to
        make a new request
      </li>
      <li class="govuk-!-margin-bottom-1"><strong>Remove bookmark:</strong> Removes the report from the list</li>
    </ul>
  {% endset -%}

  {% if type === 'bookmark' %}
    {% set helpHtml %}
      {{ mainBookmarkHelpHtml | dpr.safe }}
      <h3>Table details</h3>
      {{ productHelpHtml | dpr.safe }}
      {{ descriptionHelpHtml | dpr.safe }}
      {{ actionsHelpBMHtml | dpr.safe }}
    {% endset -%}
  {% endif %}

  {% if type === 'requested' %}
    {% set helpHtml %}
      {{ mainRequestedHelpHtml | dpr.safe }}
      <h3>Table details</h3>
      {{ productHelpHtml | dpr.safe }}
      {{ filtersHelpHtml | dpr.safe }}
      {{ statusHelpHtml | dpr.safe }}
      {{ actionsHelpHtml | dpr.safe }}
    {% endset -%}
  {% endif %}

  {% if type === 'viewed' %}
    {% set helpHtml %}
      {{ mainViewedHelpHtml | dpr.safe }}
      <h3>Table details</h3>
      {{ productHelpHtml | dpr.safe }}
      {{ filtersViewedHelpHtml | dpr.safe }}
      {{ statusViewedHelpHtml | dpr.safe }}
      {{ actionsViewedHelpHtml | dpr.safe }}
    {% endset -%}
  {% endif %}

  {% if type === 'subscriptions' %}
    {% set helpHtml %}
      {{ mainSubsHelpHtml | safe }}
      <h3>Table details</h3>
      {{ productHelpHtml | safe }}
      {{ descriptionHelpHtml | safe }}
      {{ actionsSubsHelpHtml | safe }}
    {% endset -%}
  {% endif %}

  <div class="dpr-my-reports-help">
    {{
      govukDetails({
        summaryText: 'Help',
        html: helpHtml
      })
    }}
  </div>
{% endmacro %}
