<?php

declare(strict_types=1);

namespace App\Application\LiveComponents\Services;

use App\Application\LiveComponents\ValueObjects\TimeRange;
use App\Framework\LiveComponents\Attributes\DataProvider;

/**
 * DatabaseMetricsDataProvider - Loads metrics from database
 *
 * Production implementation - loads real metrics data
 * TODO: Implement actual database queries
 */
#[DataProvider(name: 'database')]
final readonly class DatabaseMetricsDataProvider implements MetricsDataProvider
{
    public function __construct(
        // TODO: Inject repositories/services needed for metrics
        // private readonly MetricsRepository $repository,
        // private readonly AnalyticsService $analytics
    ) {
    }

    public function getMetricsForTimeRange(TimeRange $timeRange): array
    {
        // TODO: Implement database query to load metrics
        // Example:
        // return $this->repository->getMetricsByTimeRange($timeRange);

        throw new \RuntimeException(
            'DatabaseMetricsDataProvider not yet implemented. Use DemoMetricsDataProvider for now.'
        );
    }

    public function refreshMetrics(TimeRange $timeRange): array
    {
        // TODO: Implement cache bypass for fresh data
        // Example:
        // return $this->repository->getMetricsByTimeRange($timeRange, bypassCache: true);

        throw new \RuntimeException(
            'DatabaseMetricsDataProvider not yet implemented. Use DemoMetricsDataProvider for now.'
        );
    }
}
