from typing import Dict
from pathlib import Path
from typing import List


def make_true_relatives(
    probes: Dict[str, Path], galleries: Dict[str, List[Path]]
) -> Dict[str, List[int]]:
    """
    Make a list of true relatives for each probe. Each true relative faces will be
    represented by its index in the gallery array.

    Parameters
    ----------------
    probes:
        A dictionary mapping FIDs to probes.
    galleries:
        A dictionary mapping split names to faces in the gallery for that split.

    Returns
    ---------------
    A dictionary whose keys are FIDs, and who values are lists of ints. Each key represents
    a probe, since each family has one probe. Each value represents a list of true relatives of
    that probe in the gallery as indices in the gallery.

    """
    true_relatives = {fid: [] for fid in probes}
    for split_name in galleries:
        for idx, face in enumerate(galleries[split_name]):
            fid = face.parent.parent.name
            true_relatives[fid].append(idx)

    return true_relatives