<?php

namespace App\Http\Requests\Parents;

use App\Http\Requests\ApiFormRequest;

class ParentRegistrationRequest extends ApiFormRequest
{
    public function rules(): array
    {
        return [
            'students' => ['nullable', 'array'],
            'students.*.firstname' => ['required_with:students', 'string', 'max:255'],
            'students.*.lastname' => ['required_with:students', 'string', 'max:255'],
            'students.*.dob' => ['required_with:students', 'date'],
            'students.*.gender' => ['required_with:students', 'string', 'max:10'],
            'students.*.registration_grade' => ['nullable', 'string', 'max:50'],
            'students.*.photo_consent' => ['nullable', 'boolean'],
            'students.*.is_new' => ['nullable', 'boolean'],
            'students.*.allergies' => ['nullable', 'array'],
            'students.*.medical_conditions' => ['nullable', 'array'],
            'emergency_contacts' => ['nullable', 'array'],
            'emergency_contacts.*.name' => ['required_with:emergency_contacts', 'string', 'max:150'],
            'emergency_contacts.*.cellphone' => ['required_with:emergency_contacts', 'string', 'max:30'],
            'emergency_contacts.*.email' => ['nullable', 'email', 'max:150'],
            'emergency_contacts.*.relation' => ['nullable', 'string', 'max:80'],
        ];
    }
}
