<?php

namespace App\Http\Controllers\Student;

use App\Http\Controllers\Admin\PageController;
use App\Http\Controllers\Student\Concerns\ResolvesStudentScope;
use App\Models\DisciplinaryCase;
use Illuminate\View\View;

class DisciplineController extends PageController
{
    use ResolvesStudentScope;

    public function index(): View
    {
        $student = $this->ensureStudent();

        $cases = DisciplinaryCase::query()
            ->with(['schoolClass'])
            ->where('subject_student_id', $student->id)
            ->whereIn('stage', ['closed', 'dismissed'])
            ->latest()
            ->paginate(15);

        return $this->page('student.discipline.index', [
            'crumbTitle' => 'Discipline',
            'crumbSub' => 'Your disciplinary records',
            'cases' => $cases,
        ]);
    }
}
