<?php

namespace App\Http\Requests;

use App\Models\User;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;

class ProfileUpdateRequest extends FormRequest
{
    /**
     * Get the validation rules that apply to the request.
     *
     * @return array<string, \Illuminate\Contracts\Validation\Rule|array|string>
     */
    public function rules(): array
    {
        return [
            'name' => ['required', 'string', 'max:255'],
            'email' => ['required', 'string', 'lowercase', 'email', 'max:255', Rule::unique(User::class)->ignore($this->user()->id)],
            'bio' => ['nullable','string','min:3','max:255'],
            'company' => ['nullable','string', 'max:500'],
            'job' => ['nullable','string', 'max:255'],
            'mobile' =>['nullable', 'regex:/^\+\d{1,3}\d{9}$/'],
            'mail' => ['nullable','string','lowercase','email','max:255'],
            'address' => ['nullable','string','min:3','max:255'],
        ];
    }
}
