<?php

namespace App\Http\Requests\CRM;

use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;

class UpdateIndividualRequest extends FormRequest
{

    public function rules(): array
    {
        $individual = $this->route('individual');

        return [
            'first_name' => 'required|string|max:255',
            'last_name'  => 'required|string|max:255',
            'email'      => ['required', 'email', Rule::unique('individuals', 'email')->ignore($individual->id)],
            'mobile'     => 'required|string|max:255',
            'phone'      => 'nullable|string|max:255',
            'resident'   => 'boolean',
            'official'   => 'boolean',
        ];
    }
}
