<?php

declare(strict_types=1);

namespace App\Framework\SlidingWindow;

use App\Framework\Core\ValueObjects\Duration;
use App\Framework\Core\ValueObjects\Timestamp;

/**
 * Generic sliding window interface for time-based data collection
 *
 * @template T
 */
interface SlidingWindow
{
    /**
     * Record a value with timestamp
     *
     * @param mixed $value
     */
    public function record(mixed $value, Timestamp $timestamp): void;

    /**
     * Get all values within the window
     *
     * @return array<mixed>
     */
    public function getValues(?Timestamp $now = null): array;

    /**
     * Get aggregated statistics for the window
     */
    public function getStats(?Timestamp $now = null): SlidingWindowStats;

    /**
     * Clear all data from the window
     */
    public function clear(): void;

    /**
     * Get window configuration
     */
    public function getWindowSize(): Duration;

    /**
     * Get window identifier
     */
    public function getIdentifier(): string;
}
