import type { AggUiLabels, DagStepProgress, EventTradingState, VenueMarket, VenueMarketOutcome } from "@agg-build/hooks";
import type { SmartRouteResponse } from "@agg-build/sdk";
import type { PlaceOrderRoutingRow, PlaceOrderStatus, PlaceOrderTab, TradingVenue } from "../types";
export type PlaceOrderProps = {
    /** Custom class name applied to the place-order root. */
    className?: string;
    /** Custom class name applied to the place-order elements. */
    classNames?: PlaceOrderClassNames;
    /** Trading state used to drive markets, balances, and quotes. */
    eventTradingState?: EventTradingState;
    /** Whether the place-order panel should render its loading state. */
    isLoading?: boolean;
    /** Whether the primary submit action should be disabled. */
    isPrimaryActionDisabled?: boolean;
    /** Whether the primary submit action should show a loading spinner. */
    isPrimaryActionLoading?: boolean;
    /** Called when the entered order amount changes. */
    onAmountChange?: (amount: number) => void;
    /** Called when the place-order panel should close. */
    onClose?: () => void;
    /** Called when the selected outcome changes. */
    onOutcomeChange?: (outcomeId: string) => void;
    /** Called when the primary action is triggered. */
    onPrimaryAction?: (context?: {
        quoteId?: string;
    }) => void;
    /** Called when the slippage control value changes. */
    onSlippageChange?: (value: string) => void;
    /** Called when the active trade tab changes. */
    onTabChange?: (tab: PlaceOrderTab) => void;
    /** Optional chain balance overrides keyed by chain ID. */
    chainBalancesOverride?: Record<string, number>;
    /** Called when order execution completes successfully. */
    onSuccess?: (summary: PlaceOrderExecutionSummary) => void;
    /** Called when order execution fails. */
    onError?: (error: Error) => void;
    /** Called on each execution phase transition (finding-route → submitting → executing → success → failed). */
    onExecutionStateChange?: (state: PlaceOrderSubmissionProgressState) => void;
    /** Optional resolved-event claim summary shown in read-only state. */
    resolvedClaim?: PlaceOrderResolvedClaimSummary;
};
export type PlaceOrderResolvedClaimSummary = {
    /** Resolution date label, e.g. "Mar 21, 2026". */
    resolutionDateLabel: string;
    /** Winning outcome label, e.g. "Yes". */
    winningOutcomeLabel: string;
    /** Shares label, e.g. "286 Yes". */
    sharesLabel: string;
    /** Total payout label, e.g. "$8.50". */
    totalPayoutLabel: string;
    /** Whether the claim action is currently in-flight. */
    isClaiming?: boolean;
    /** Optional claim action for eligible winnings. */
    onClaim?: () => void;
};
export type PlaceOrderClassNames = {
    root?: string;
    body?: string;
    header?: string;
    content?: string;
    footer?: string;
};
export type PlaceOrderSlippageControlProps = {
    /** Default slippage value shown when the control initializes. */
    defaultValue: string;
    /** Whether the control should animate state changes. */
    enableAnimations: boolean;
    /** Minimum allowed slippage percentage. */
    minimumValue: number;
    /** Called when the slippage value changes. */
    onChange?: (value: string) => void;
    /** Controlled slippage value. */
    value: string;
};
export type PlaceOrderRouteCardKind = "split" | "venue";
export type PlaceOrderRouteCard = {
    id: string;
    hint: string;
    kind: PlaceOrderRouteCardKind;
    label: string;
    numericValue: number;
    quoteData: SmartRouteResponse;
    rows?: PlaceOrderRoutingRow[];
    value: string;
    venue?: TradingVenue;
    /** Whether the venue is unavailable in the user's region (geo-blocked). */
    isUnavailable?: boolean;
};
export type PlaceOrderOutcomeClassNameParams = {
    enableAnimations: boolean;
    isActive: boolean;
    isPositive: boolean;
};
export type PlaceOrderOutcomeLabelValue = Pick<VenueMarketOutcome, "id" | "label">;
export type PlaceOrderVenueOutcome = Pick<VenueMarketOutcome, "id" | "label" | "price"> & {
    title?: string | null;
};
export type PlaceOrderVenueQuote = {
    price: number;
    venue: TradingVenue;
    venueMarketId: string;
    venueMarketOutcomeId: string;
};
export type PlaceOrderResultTone = "default" | "success";
export type PlaceOrderQuoteResult = {
    hint: string;
    value: string;
};
export type PlaceOrderTradingLabels = AggUiLabels["trading"];
export type PlaceOrderExecutionStep = {
    id: string;
    label: string;
    tone?: "complete" | "warning" | "error";
    venue?: TradingVenue;
};
export type PlaceOrderExecutionStepGroup = PlaceOrderExecutionStep[];
export type PlaceOrderTerminalOrderEvent = {
    orderId: string;
    venue: string;
    event: "filled" | "partial_fill" | "failed";
    filledAmountRaw?: string;
    remainingAmountRaw?: string;
    errorReason?: string;
    timestamp: number;
};
export type PlaceOrderFailureStepTone = "complete" | "warning" | "error";
export type PlaceOrderFailureStep = {
    id: string;
    label: string;
    tone: PlaceOrderFailureStepTone;
    venue?: TradingVenue;
};
export type PlaceOrderFailureAction = {
    id: string;
    label: string;
    variant: "retry" | "dismiss" | "continue" | "skip";
};
export type PlaceOrderFailureKind = "partial_fill" | "venue_unavailable" | "market_resolved" | "generic";
export type PlaceOrderFailureSummary = {
    actionLabel: string;
    actions: PlaceOrderFailureAction[];
    errorMessage?: string;
    eventImage?: string | null;
    eventSubtitle?: string;
    eventTitle: string;
    kind: PlaceOrderFailureKind;
    steps: PlaceOrderFailureStep[];
};
export type ResolvePlaceOrderQuoteResultParams = {
    labels: PlaceOrderTradingLabels;
    quoteData: SmartRouteResponse | null;
    tradeSide: PlaceOrderTab;
};
export type ResolvePlaceOrderQuoteStatusParams = {
    amount: number;
    labels: PlaceOrderTradingLabels;
    quoteData: SmartRouteResponse | null;
    selectedMarket: VenueMarket | null;
};
export type ResolvePlaceOrderTabKeyParams = {
    currentTab: PlaceOrderTab;
    key: string;
};
export type PlaceOrderQuoteStatus = PlaceOrderStatus | undefined;
export type PlaceOrderSubmissionProgressPhase = "finding-route" | "submitting" | "executing" | "success" | "failed";
export type PlaceOrderExecutionSummary = {
    tradeSide?: PlaceOrderTab;
    shares: string;
    avgPrice: string;
    estimatedCost: string;
    venue?: string;
    eventTitle?: string;
    eventDateLabel?: string;
    eventImage?: string | null;
    actionLabel?: string;
    actionTone?: "positive" | "negative";
    amountLabel?: string;
    toWinLabel?: string;
    potentialReturnLabel?: string;
    executionStepGroups?: PlaceOrderExecutionStepGroup[];
    shareText?: string;
};
export type PlaceOrderSubmissionProgressState = {
    errorMessage?: string;
    executionVenue?: TradingVenue;
    failureSummary?: PlaceOrderFailureSummary;
    orderId?: string;
    orderIds?: string[];
    phase: PlaceOrderSubmissionProgressPhase;
    summary?: PlaceOrderExecutionSummary;
    dagProgress?: DagStepProgress | null;
};
