<?php

require __DIR__ . '/vendor/autoload.php';

$app = require_once __DIR__ . '/bootstrap/app.php';
$kernel = $app->make(Illuminate\Contracts\Console\Kernel::class);
$kernel->bootstrap();

$service = app(App\Services\QuestionServiceApi::class);
$result = $service->listQuestions(1, 5);

echo "Total: " . ($result['meta']['total'] ?? 0) . PHP_EOL;
echo "Questions: " . count($result['data'] ?? []) . PHP_EOL;

if (!empty($result['data'])) {
    echo "First question: " . substr($result['data'][0]['stem'] ?? '', 0, 80) . PHP_EOL;
    echo "Has LaTeX: " . (str_contains($result['data'][0]['stem'] ?? '', '$') ? 'Yes' : 'No') . PHP_EOL;
}
