<% content_for :title, "Cookies" %>

<div class="govuk-grid-row">
  <div class="govuk-grid-column-two-thirds">
    <h1 class="govuk-heading-xl">Cookies</h1>
    <p>Cookies are small files saved on your phone, tablet or computer when you visit a website.</p>
    <p>We use cookies to make the Submit social housing lettings and sales data (CORE) (the service) work and collect information about how you use our service.</p>

    <h2 class="govuk-heading-m">Essential cookies</h2>
    <p>Essential cookies keep your information secure while you use the service. We do not need to ask permission to use them. </p>

    <table class="govuk-table">
      <caption class="govuk-visually-hidden">Essential cookies</caption>
      <thead class="govuk-table__head">
        <tr class="govuk-table__row">
          <th class="govuk-table__header">Name</th>
          <th class="govuk-table__header">Purpose</th>
          <th class="govuk-table__header">Expires</th>
        </tr>
      </thead>
      <tbody class="govuk-table__body">
        <tr class="govuk-table__row">
          <td class="govuk-table__cell">_data_collector_session</td>
          <td class="govuk-table__cell" width="50%">Used to keep you signed in</td>
          <td class="govuk-table__cell">2 weeks</td>
        </tr>
        <tr class="govuk-table__row">
          <td class="govuk-table__cell">accept_analytics_cookies</td>
          <td class="govuk-table__cell" width="50%">Saves your cookie consent settings</td>
          <td class="govuk-table__cell">1 year</td>
        </tr>
      </tbody>
    </table>

    <h2 class="govuk-heading-m">Analytics cookies (optional)</h2>
    <p>With your permission, we use Google Analytics to collect data about how you use the service. This information helps us to improve our service.</p>
    <p>Google is not allowed to use or share our analytics data with anyone.</p>
    <p>Google Analytics stores anonymised information about:</p>

    <ul class="govuk-list govuk-list--bullet">
      <li>how you got to the service</li>
      <li>the pages you visit on the service and how long you spend on them</li>
      <li>any errors you see while using the service</li>
    </ul>

    <table class="govuk-table">
      <caption class="govuk-visually-hidden">Google Analytics cookies</caption>
      <thead class="govuk-table__head">
        <tr class="govuk-table__row">
          <th class="govuk-table__header">Name</th>
          <th class="govuk-table__header">Purpose</th>
          <th class="govuk-table__header">Expires</th>
        </tr>
      </thead>
      <tbody class="govuk-table__body">
        <tr class="govuk-table__row">
          <td class="govuk-table__cell">_ga</td>
          <td class="govuk-table__cell" width="50%">Checks if you’ve visited the service before. This helps us count how many people visit our site.</td>
          <td class="govuk-table__cell">2 years</td>
        </tr>
        <tr class="govuk-table__row">
          <td class="govuk-table__cell">_gid</td>
          <td class="govuk-table__cell" width="50%">Checks if you’ve visited the service before. This helps us count how many people visit our site.</td>
          <td class="govuk-table__cell">24 hours</td>
        </tr>
      </tbody>
    </table>

    <%= form_for @cookies_form, url: cookies_path, method: :put do |f| %>
      <%= f.govuk_collection_radio_buttons(
        :accept_analytics_cookies,
        @cookies_form.consent_options,
        :id,
        :name,
        inline: true,
        legend: { text: "Do you want to accept analytics cookies?" },
      ) %>
      <%= f.govuk_submit "Save cookie settings" %>
    <% end %>
  </div>
</div>