from pathlib import Path


def prov_data_paths(data_dir: Path) -> dict:
    """Build a dictionary to map a province to it's GeoPackage file."""

    paths = {}
    for item in data_dir.rglob('*NRN_*.gpkg'):
        parts = item.name.split('_')
        prcode = parts[1]
        major = parts[2]
        minor = parts[3]
        if '.' in minor:
            minor = minor.split('.')[0]
        paths[prcode] = {'path': item, 'major': major, 'minor': minor}
    return paths