"""Utilities for reconciling billing records."""

from __future__ import annotations

from ..stores import BillingStore


def reconcile_pending(billing_store: BillingStore, *, older_than_minutes: int = 30) -> int:
    """Finalize pending billing records older than the threshold.

    Returns the number of records transitioned to "finalized".
    """
    return int(billing_store.reconcile_pending(older_than_minutes=older_than_minutes))


__all__ = ["reconcile_pending"]
