/** 玩法目录（`play/effective`）需要全量刷新时派发。 */
export const PLAY_CATALOG_REFRESH_EVENT = "lottery-play-catalog-refresh";

export type PlayCatalogRefreshSource = "play_config" | "odds" | "risk_cap" | "play_toggle";

export function dispatchPlayCatalogRefresh(source?: PlayCatalogRefreshSource): void {
  if (typeof window !== "undefined") {
    window.dispatchEvent(
      new CustomEvent(PLAY_CATALOG_REFRESH_EVENT, { detail: { source } }),
    );
  }
}
