"""Fetch all competitions available."""

# AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/competition.ipynb.

# %% auto 0
__all__ = ['fetch_all_competitions']

# %% ../nbs/competition.ipynb 4
import pandas as pd

# %% ../nbs/competition.ipynb 5
def fetch_all_competitions():
    """Fetches all competition information that exists: \n
    * match_id \n
    * home_team_id \n
    * away_team_id \n
    * date
    """

    try:
        print("Fetching all competition...")
        date_url = "https://raw.githubusercontent.com/seanyboi/rugbydata/main/data/v3/competition/competition_registry.parquet"
        competitions = pd.read_parquet(date_url, engine="pyarrow")
        return competitions
    except Exception as _:
        print(
            "No match information either because no competition took place or rugbypy does not have access to the competition data. Please raise an issue if neither."
        )
