from pathlib import Path
from typing import List


def get_regions_data(path: Path) -> List[dict]:
    """Gets base data for a region in a page.

    :param path: Path to the region directory.
    :return: List of dictionaries holding base region data.
    """
    regions = list()

    for region in sorted(path.glob("./*.offset")):
        region_dict = dict()

        with region.open("r") as file:
            (x, y) = file.read().split(",")
            region_dict["name"] = str(region.stem)
            region_dict["offset"] = (int(x), int(y))

        regions.append(region_dict)

    return regions