##############
``legacy.yml``
##############

.. list-table::
   :widths: auto

   * - YAML File
     - ``legacy.yml``
   * - Schema File
     - ``legacyschema.json``
   * - Loader Class
     - :class:`yaml.SafeLoader`
   * - Python Module
     - :mod:`ng911ok.lib.legacy`
   * - Python Class
     - :class:`~ng911ok.lib.legacy.LegacyFieldInfo`

YAML Structure
==============

The root object is a mapping with the no tag applied.

Top-Level Keys
--------------

.. list-table::
   :widths: auto

   * - ``directions``
     - Mapping of next-gen (unabbreviated) directions to legacy (abbreviated) directions.
   * - ``street_types``
     - Mapping of next-gen (unabbreviated) street types to legacy (abbreviated) street types. The keys (next-gen) are unique, but the values (legacy) may by duplicated.
   * - ``fields``
     - Sequence of mappings, each representing a legacy/next-gen field pair. Each mapping should have ``next_gen`` and ``legacy`` keys set to the :attr:`~ng911ok.lib.config_dataclasses.NG911Field.role` attributes of the relevant fields, a ``concatenation`` key indicating whether the fields are intended to be contatenations of other fields, an ``equal`` key indicating whether the values of the two fields should be equal, and, if relevant, a ``value_map`` key referencing the ``directions`` or ``street_types`` top-level keys via anchor.

Tags
----

No tags are used in ``legacy.yml``.

Anchors
-------

.. list-table::
   :widths: auto

   * - ``&directions_value_map``
     - Reference to the ``directions`` top-level key. Intended for use in the ``value_map`` keys of mappings under the ``fields`` top-level key.
   * - ``&street_types_value_map``
     - Reference to the ``street_types`` top-level key. Intended for use in the ``value_map`` keys of mappings under the ``fields`` top-level key.

Python Implementation
=====================

The ``LegacyFieldInfo`` Class
-----------------------------

The data from the YAML file can be obtained by calling :meth:`LegacyFieldInfo.load`, which will return a ``list`` of :class:`~ng911ok.lib.LegacyFieldInfo` objects. Alternatively, data for a specific field can be obtained via :meth:`LegacyFieldInfo.for_field`.