<?php

namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

class UpdateProfileRequest extends FormRequest
{
    public function authorize(): bool
    {
        return (bool) $this->user();
    }

    public function rules(): array
    {
        return [
            'name' => 'required|string|max:255',
            'email' => 'nullable|email|max:255',
            'gst_number' => [
                'nullable',
                'string',
                'max:15',
                'regex:/^[0-9A-Z]{15}$/',
            ],
            'avatar' => 'nullable|image|mimes:jpeg,jpg,png,gif|max:2048',
        ];
    }
}
