<?php

namespace App\Http\Requests\Grade;

use Illuminate\Foundation\Http\FormRequest;

class StoreGradeRequest extends FormRequest
{
    public function authorize(): bool { return $this->user() !== null; }

    public function rules(): array
    {
        return [
            'student_id' => ['required', 'integer'],
            'classroom_id' => ['required', 'integer'],
            'subject_id' => ['required', 'integer'],
            'exam_id' => ['nullable', 'integer'],
            'score' => ['required', 'numeric', 'min:0'],
            'max_score' => ['nullable', 'numeric', 'min:1'],
            'description' => ['nullable', 'string', 'max:1000'],
        ];
    }
}
