/** * @fileoverview Game progress calculation utilities for various sports. * This module provides functions to calculate game progress in basis points (BPS) * for different sports including Soccer, Basketball, Football, and Baseball. * It supports multiple odds providers (LSports, OpticOdds) with provider-specific * period mapping logic. * @module game_progress/calculate.game.progress */ import { SportGroup } from "@prisma/client"; import { GameProviderInput } from "../.."; /** * Calculates the game progress in basis points (BPS) for a given sport. * This is the core calculation function used by all sport-specific progress functions. * * @param currentPeriod - The current period/quarter/half number from the provider * @param gameClock - The game clock string (e.g., "12:30", "45:00") * @param sportGroup - The sport group enum value (Soccer, Basketball, Football, Baseball) * @param provider - The odds service provider (LSports, OpticOdds) * @param isTopOfInning - For baseball only: whether it's the top of the inning * @param leagueSelector - Optional league identifier for league-specific configurations (e.g., NCAA) * @returns The game progress in basis points (0-10000) or null if invalid input * * @example * // Calculate NBA game progress at 5:30 remaining in Q2 * calculateGameProgress(2, "05:30", SportGroup.Basketball, OddsServices.LSPORTS) * // Returns approximately 3125 BPS (31.25% through the game) */ export declare const calculateGameProgress: (currentPeriod: number, gameClock: string, sportGroup: SportGroup, provider: GameProviderInput, isTopOfInning?: boolean, leagueSelector?: string, totalPeriodsOverride?: number) => number | null; /** * Calculates game progress for Soccer matches in basis points (BPS). * Soccer uses 2 x 45 minute halves with a count-up clock. * * @param currentPeriod - The current half (LSports: 10=1st half, 20=2nd half; OpticOdds: 1 or 2) * @param gameClock - The elapsed time in "MM:SS" format (e.g., "32:15") * @param provider - The odds service provider * @returns Game progress in BPS (0-10000) or null if invalid * * @example * // First half at 30 minutes * calculateSoccerProgress(10, "30:00", SportGroup.Soccer, OddsServices.LSPORTS) * // Returns ~3333 BPS (33.33% through the game) */ export declare const calculateSoccerProgress: (currentPeriod: number, gameClock: string, provider: GameProviderInput) => number | null; /** * Calculates game progress for Basketball (NBA) matches in basis points (BPS). * NBA uses 4 x 12 minute quarters with a countdown clock. * * @param currentPeriod - The current quarter (1-4) * @param gameClock - The time remaining in "MM:SS" format (e.g., "08:45") * @param provider - The odds service provider * @returns Game progress in BPS (0-10000) or null if invalid * * @example * // Third quarter with 6 minutes remaining * calculateBasketballProgress(3, "06:00", SportGroup.Basketball, OddsServices.LSPORTS) * // Returns ~6250 BPS (62.5% through the game) */ export declare const calculateBasketballProgress: (currentPeriod: number, gameClock: string, provider: GameProviderInput) => number | null; /** * Calculates game progress for American Football (NFL) matches in basis points (BPS). * NFL uses 4 x 15 minute quarters with a countdown clock. * * @param currentPeriod - The current quarter (1-4) * @param gameClock - The time remaining in "MM:SS" format (e.g., "12:30") * @param provider - The odds service provider * @returns Game progress in BPS (0-10000) or null if invalid * * @example * // Second quarter with 8 minutes remaining * calculateFootballProgress(2, "08:00", SportGroup.Football, OddsServices.LSPORTS) * // Returns ~3667 BPS (36.67% through the game) */ export declare const calculateFootballProgress: (currentPeriod: number, gameClock: string, provider: GameProviderInput) => number | null; /** * Calculates game progress for Baseball (MLB) matches in basis points (BPS). * Baseball uses 9 innings, each with a top and bottom half. * Progress is calculated based on completed half-innings. * * @param currentPeriod - The current inning (1-9) * @param isTopOfInning - True if it's the top of the inning (away team batting) * @returns Game progress in BPS (0-10000) or null if invalid * * @example * // Top of the 5th inning * calculateBaseballProgress(5, true) * // Returns ~4444 BPS (44.44% through the game) * * @example * // Bottom of the 7th inning * calculateBaseballProgress(7, false) * // Returns ~7778 BPS (77.78% through the game) */ export declare const calculateBaseballProgress: (currentPeriod: number, isTopOfInning: boolean) => number | null; /** * Calculates game progress for NCAA Basketball (NCAAB) matches in basis points (BPS). * NCAAB uses 2 x 20 minute halves with a countdown clock (different from NBA's 4 quarters). * * @param currentPeriod - The current half (LSports: 10=1st half, 20=2nd half; OpticOdds: 1 or 2) * @param gameClock - The time remaining * @param provider - The odds service provider * @returns Game progress in BPS (0-10000) or null if invalid * * @remarks * - LSports uses period codes 10 and 20 for 1st and 2nd halves respectively * - OpticOdds uses standard 1 and 2 for halves * - Total game duration: 40 minutes (2 x 20 min halves) * * @example * // First half with 10 minutes remaining (LSports) * calculateNCAABProgress(10, "10:00", OddsServices.LSPORTS) * // Returns ~2500 BPS (25% through the game) */ export declare const calculateNCAABProgress: (currentPeriod: number, gameClock: string, provider: GameProviderInput) => number | null; /** * Calculates game progress for NCAA Football (NCAAF) matches in basis points (BPS). * NCAAF uses 2 x 30 minute halves (equivalent to 4 x 15 min quarters) with a countdown clock. * * @param currentPeriod - The current half (LSports: 10=1st half, 20=2nd half; OpticOdds: 1 or 2) * @param gameClock - The time remaining in "MM:SS" format (e.g., "25:00") * @param provider - The odds service provider * @returns Game progress in BPS (0-10000) or null if invalid * * @remarks * - LSports uses period codes 10 and 20 for 1st and 2nd halves respectively * - OpticOdds uses standard 1 and 2 for halves * - Total game duration: 60 minutes (2 x 30 min halves) * - Quarters are grouped into halves for period tracking * * @example * // First half with 20 minutes remaining (LSports) * calculateNCAAFProgress(10, "20:00", OddsServices.LSPORTS) * // Returns ~1667 BPS (16.67% through the game) */ export declare const calculateNCAAFProgress: (currentPeriod: number, gameClock: string, provider: GameProviderInput) => number | null; /** * Calculates game progress for UFC (MMA) fights in basis points (BPS). * UFC standard fights are 3 rounds, while championship fights are 5 rounds. */ export declare const calculateUFCProgress: (currentPeriod: number, gameClock: string, provider: GameProviderInput) => number | null; /** * Calculates game progress for UFC fights when total rounds are known up front. * Use totalRounds=5 for championship fights so progress is smooth from round 1. */ export declare const calculateUFCProgressWithRounds: (currentPeriod: number, gameClock: string, provider: GameProviderInput, totalRounds: number) => number | null;