<?php

namespace App\Http\Requests\School;

use Illuminate\Foundation\Http\FormRequest;

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

    public function rules(): array
    {
        return [
            'student_code' => ['required', 'string', 'max:80'],
            'first_name' => ['required', 'string', 'max:120'],
            'last_name' => ['required', 'string', 'max:120'],
            'mobile' => ['nullable', 'regex:/^09\d{9}$/'],
            'father_mobile' => ['nullable', 'regex:/^09\d{9}$/'],
            'mother_mobile' => ['nullable', 'regex:/^09\d{9}$/'],
            'home_phone' => ['nullable', 'string', 'max:30'],
            'address' => ['nullable', 'string', 'max:1000'],
            'grade_level_id' => ['required', 'integer'],
            'classroom_id' => ['nullable', 'integer'],
        ];
    }
}
