<?php

namespace App\Http\Requests\Admin\Dependent;

use App\Enums\RelationEnum;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;

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

    public function rules(): array
    {
        return [
            'assigned_member_id' => ['required', 'integer', 'exists:members,id'],
            'name'               => ['required', 'string', 'max:255'],
            'relation'           => ['required', 'integer', Rule::in(RelationEnum::values())],
            'dob'                => ['nullable', 'date', 'before:today'],
            'phone'              => ['nullable', 'string', 'max:20'],
        ];
    }
}
