from typing import OrderedDict


def _add_mlst(mlsts: dict) -> dict:
    """
    Read through MLST results and create column each schema.

    Args:
        mlsts (dict): The MLST results associated with a sample

    Returns:
        dict: Per schema MLST hits
    """
    results = OrderedDict()
    for key, vals in mlsts.items():
        schema, tool = key.split('-')
        prefix = f"mlst_{tool}" if schema == "default" else f"mlst_{schema}_{tool}"

        if tool == "blast":
            results[f"{prefix}_st"] = vals['ST']['st']
            results[f"{prefix}_loci"] = len(vals) - 1
            results[f"{prefix}_perfect_matches"] = vals['ST']['perfect_matches']
        else:
            for k, v in vals.items():
                results[f"{prefix}_{k.lower()}"] = v
    return results