from __future__ import annotations

from .config import RateLimiterConfig
from .result import ConsumeResult

class RateLimiter:
    """Token-bucket limiter with optional per-second sub-buckets."""

    def __init__(self, config: RateLimiterConfig) -> None: ...
    def refill(self) -> None: ...
    def try_consume(self, force: bool = ...) -> ConsumeResult: ...
    def try_consume_multiple(
        self, num_tokens: int, force: bool = ...
    ) -> ConsumeResult: ...
    def tokens_remaining(self) -> int: ...
    def usage(self) -> float: ...
    @classmethod
    def per_window(cls, capacity: int, window_s: int) -> RateLimiter: ...
    @classmethod
    def per_second(cls, capacity: int) -> RateLimiter: ...
    @classmethod
    def per_minute(cls, capacity: int) -> RateLimiter: ...
