import csv


def get_versions(csv_dir):
    """Get version of pokemon's games.

    Args:
        csv_dir (pathlib.Path): Path to csv directory.

    Returns:
        list: List of dict containing infos to build
            pokediadb.models.Version object.

    Raises:
        FileNotFoundError: Raised if versions.csv does not exist.

    """
    pkm_versions = []
    with (csv_dir / "versions.csv").open(encoding="utf8") as f_version:
        reader = csv.reader(f_version)
        next(reader)  # Skip header

        for row in reader:
            pkm_versions.append({"id": int(row[0]), "group": int(row[1])})

    return pkm_versions