<?php

namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

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

    public function rules(): array
    {
        return [
            'dni' => 'required|unique:students,dni',
            'name' => 'required|min:3',
            'email' => 'required|email|unique:students,email',
        ];
    }

    public function messages(): array
    {
        return [
            'dni.required' => 'El DNI es obligatorio',
            'dni.unique' => 'El DNI ya está registrado',
            'name.required' => 'El nombre es obligatorio',
            'email.email' => 'El correo no es válido',
        ];
    }
}
