<?php

namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

class StoreGradeRequest extends FormRequest
{
    public function authorize(): bool
    {
        return true;
    }

    public function rules(): array
    {
        return [
            'student_id' => 'required|exists:students,id',
            'user_id' => 'required|exists:users,id',
            'score' => 'required|numeric|min:0|max:20',
        ];
    }

    public function messages(): array
    {
        return [
            'student_id.required' => 'El estudiante es obligatorio',
            'student_id.exists' => 'El estudiante no existe',
            'score.max' => 'La nota máxima es 20',
        ];
    }
}

