<?php

declare(strict_types=1);

namespace App\Application\LiveComponents\Services;

use App\Framework\LiveComponents\Attributes\DataProvider;

/**
 * DatabaseScrollDataProvider - Production implementation with database
 *
 * TODO: Implement actual database queries for scroll data
 */
#[DataProvider(name: 'database')]
final readonly class DatabaseScrollDataProvider implements ScrollDataProvider
{
    public function __construct(
        // TODO: Inject repositories/services needed for content
        // private readonly ContentRepository $repository
    ) {
    }

    public function getItems(int $page, int $pageSize): array
    {
        // TODO: Implement database query to load items
        // Example:
        // $offset = ($page - 1) * $pageSize;
        // return $this->repository->findPaginated($offset, $pageSize);

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

    public function getTotalCount(): int
    {
        // TODO: Implement total count query
        throw new \RuntimeException(
            'DatabaseScrollDataProvider not yet implemented. Use DemoScrollDataProvider for now.'
        );
    }

    public function hasMore(int $currentPage, int $pageSize): bool
    {
        // TODO: Implement has more check
        throw new \RuntimeException(
            'DatabaseScrollDataProvider not yet implemented. Use DemoScrollDataProvider for now.'
        );
    }
}
