<?php

namespace App\Filament\Resources\QuestionResource\Widgets;

use App\Models\Question;
use Filament\Widgets\StatsOverviewWidget as BaseWidget;
use Filament\Widgets\StatsOverviewWidget\Stat;

class QuestionStats extends BaseWidget
{
    protected function getStats(): array
    {
        return [
            Stat::make('题目总数', Question::query()->count()),
            Stat::make('选择题', Question::query()->where('question_type', 'choice')->count()),
            Stat::make('填空题', Question::query()->where('question_type', 'fill')->count()),
            Stat::make('解答题', Question::query()->where('question_type', 'answer')->count()),
        ];
    }
}
