import json


def list_of_schematized_configs(test_configs_root):
    """returns list of configuration files,
    schematized with attributes
    so that fixtures and unit tests can specify those attributes
    to find the filename of a specific configuration file,
    that can then be used to get that file.

    Each element in the list is a dict with the following keys:
    `filename`, `config_type`, `audio_format`, `spect_format`, `annot_format`
    These keys define the schema for config files.

    For example, here is the first one:
    {
      "filename": "test_eval_audio_cbin_annot_notmat.toml",
      "config_type": "eval",
      "audio_format": "cbin",
      "spect_format": null,
      "annot_format": "notmat"
    }

    The ``specific_config`` factory fixture returns a function that
    itself return a configuration ``filename``, when provided values for
    all of the other keys.
    """
    with test_configs_root.joinpath("configs.json").open("r") as fp:
        return json.load(fp)["configs"]