import requests
from bs4 import BeautifulSoup


def getResultsURLs(URL: str) -> list:
    """Finds appropriate result page link in the rounds section

    Args:
        URL (str): the URL of the division results page
        breaks (bool, optional): Return the link of the

    Returns:
        list: the URL of the requested page(s)

        RETURN SCHEMA:
        [
            <(str) URL of final places page | None if null>,
            <(str) URL of the brackets page | None if null>,
            <(str) URL of the prelim seeds page | None if null>,
        ]
    """
    retURIs = [None, None, None]
    BASE = "https://www.tabroom.com"

    r = requests.get(URL)
    soup = BeautifulSoup(r.text, 'html.parser')

    resCategories = soup.find_all(class_="blue full nowrap")
    for category in resCategories:
        name = category.get_text().lower()
        if "round results" in name: continue
        if "final places" in name: retURIs[0] = BASE + category["href"]
        elif "bracket" in name and "int'l" not in name: retURIs[1] = BASE + category["href"]
        elif "seed" in name: retURIs[2] = BASE + category["href"]

    return retURIs