---
results:
  - title: Italy
    details:
      slug: italy
    england_coronavirus_travel:
      covid_status: green
      next_covid_status:
      next_covid_status_applies_at:
      status_out_of_date: false
  - title: South Africa
    details:
      slug: south-africa
    england_coronavirus_travel:
      covid_status: red
      next_covid_status:
      next_covid_status_applies_at:
      status_out_of_date: false

---
results:
  - title: Italy
    details:
      slug: italy
    england_coronavirus_travel:
      - covid_status: not_red
        covid_status_applies_at: "2021-12-20T:02:00.000+00:00"
      - covid_status: red
        covid_status_applies_at: "2022-02-20T:02:30.000+00:00"
  - title: South Africa
    details:
      slug: south-africa
    england_coronavirus_travel:
      - covid_status: red
        covid_status_applies_at: "2021-12-20T:02:00.000+00:00"
      - covid_status: not_red
        covid_status_applies_at: "2022-02-20T:16:00.000+00:00"

Change structure of COVID status YAML
Change structure of COVID status YAML

The original plan was to use this YAML file to test content changes
whilst the data was being added to the World Location API in Whitehall.
Therefore the data was originally structured to mimic the expected data
from the API.

In the API, a database transaction will used to update the data
automatically, so that it will always have the correct values for
"covid_status", "next_covid_status" and "next_covid_status_applies_at",
so the logic that relies on this data only needs to find the existing
values.

However it's not possible to automatically update a YAML file in the
same way as a database. To be able programmatically find the current and
next COVID statuses the structure of the YAML needs to change. Instead
of one value for current and next, the YAML now stores a list of COVID
statuses with an "applies at" date (the naming tries to reflect the
agreed naming for the API as much as possible).

This follows the same pattern that was used to find current and future
restrictions in the Local Restrictions postcode checker [1].

The WorldLocation class will be updated in the next commit to use
today's date to find the current and next COVID statuses.

[1]: https://github.com/alphagov/collections/blob/24f50fa14e11133d92b61a0954b0b91e6dd206d1/config/local_restrictions.yml
