<?php

declare(strict_types=1);

namespace App\Framework\RateLimit\Storage;

use App\Framework\RateLimit\TokenBucket;

interface StorageInterface
{
    public function getRequestsInWindow(string $key, int $windowStart, int $windowEnd): array;

    public function addRequest(string $key, int $timestamp, int $ttl): void;

    public function getTokenBucket(string $key): ?TokenBucket;

    public function saveTokenBucket(string $key, TokenBucket $bucket): void;

    public function clear(string $key): void;

    // ===== WAF Intelligence Extensions =====

    /**
     * Get baseline traffic data for anomaly detection
     */
    public function getBaseline(string $key): ?array;

    /**
     * Update baseline with new traffic data
     */
    public function updateBaseline(string $key, int $rate): void;
}
