import type { LiveBestPriceCandidate } from "@agg-build/hooks";
/** Which data tier produced the winning price + venue. */
export type BestOutcomeSource = "ws" | "rest-best" | "rest-midpoint" | "static";
/**
 * The single, unified result for an outcome pill: price and venue resolved
 * together from the *same* tier, so the displayed price and the venue logo can
 * never disagree. `venueMarketId`, `source` and `updatedAt` are carried for
 * telemetry/debugging and to let callers reason about freshness.
 */
export interface BestOutcomeCandidate {
    price: number;
    venue: string | undefined;
    venueMarketId: string | undefined;
    outcomeId: string;
    source: BestOutcomeSource;
    updatedAt: number | undefined;
}
export interface SelectBestOutcomeArgs {
    outcomeId: string | null | undefined;
    outcomeLabel?: string | null | undefined;
    /** Active trade side. When set, the best ask (buy) / best bid (sell) wins. */
    selection?: "buy" | "sell" | undefined;
    /**
     * Live WS candidate for this outcome — already folded across all venues for
     * the outcome's MVMO group (see `buildLiveBestPriceCandidates`). Carries the
     * venue that owns each side, so when a different venue takes the best live
     * price the logo follows the price.
     */
    live?: LiveBestPriceCandidate | null | undefined;
    /** REST cross-venue best bid/ask (fallback when WS hasn't landed). */
    restBest?: {
        bestBid?: number;
        bestAsk?: number;
    } | null | undefined;
    /** REST venue that produced each side of `restBest`. */
    restBestVenues?: {
        bestBidVenue?: string;
        bestAskVenue?: string;
    } | null | undefined;
    /** REST per-outcome midpoint (display-path fallback). */
    restMidpoint?: number | null | undefined;
    /** Venue that produced `restMidpoint`. */
    restMidpointVenue?: string | null | undefined;
    /** Cluster-wide "Yes" reference midpoint (display path, "yes" labels only). */
    bestMidpoint?: number | null | undefined;
    /** Venue that produced `bestMidpoint`. */
    bestMidpointVenue?: string | null | undefined;
    /** Final static fallback — the outcome's payload price. */
    staticPrice?: number | null | undefined;
    /** Venue for the static fallback (typically the local market's own venue). */
    staticVenue?: string | null | undefined;
    /** Resolves a venue name → its venueMarketId within the cluster (best effort). */
    venueMarketIdByVenue?: ReadonlyMap<string, string> | null | undefined;
}
/**
 * Resolve the single best price + venue for an outcome across all venues.
 *
 * Candidate priority (price and venue are always taken from the SAME tier):
 *   With a trade selection (buy/sell):
 *     1. fresh WS best ask/bid for that side  → source "ws"
 *     2. REST best ask/bid for that side       → source "rest-best"
 *     3. fresh WS midpoint                      → source "ws"
 *     4. REST per-outcome midpoint              → source "rest-midpoint"
 *     5. static outcome price                   → source "static"
 *   Display path (no selection):
 *     1. fresh WS midpoint                      → source "ws"
 *     2. cluster "Yes" reference (yes labels)   → source "rest-midpoint"
 *     3. REST per-outcome midpoint              → source "rest-midpoint"
 *     4. static outcome price                   → source "static"
 *
 * Because WS is preferred per side over REST, a stale REST snapshot can never
 * override newer live data — and because the venue is read from whichever tier
 * supplied the price, the logo and the price switch together.
 */
export declare const selectBestOutcomeCandidate: (args: SelectBestOutcomeArgs) => BestOutcomeCandidate | undefined;
/**
 * Build a venue-name → venueMarketId lookup across a cluster (including matched
 * siblings). First occurrence wins. Used to resolve the winning venue's market
 * id for {@link selectBestOutcomeCandidate}.
 */
export declare const buildVenueMarketIdByVenue: (venueMarkets: ReadonlyArray<{
    id?: string;
    venue?: string | null;
    matchedVenueMarkets?: ReadonlyArray<{
        id?: string;
        venue?: string | null;
    }> | null;
}> | null | undefined) => Map<string, string>;
