<?php

namespace App\Http\Requests;

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

class UpdateBusinessRequest extends FormRequest
{
    public function authorize(): bool
    {
        return $this->user()?->isOwner() ?? false;
    }

    public function rules(): array
    {
        return ['name' => ['required', 'string', 'max:150'], 'phone' => ['nullable', 'string', 'max:30'], 'email' => ['nullable', 'email', 'max:255'], 'address' => ['nullable', 'string', 'max:1000'], 'currency' => ['required', Rule::in(['NGN', 'GHS', 'ZAR', 'KES'])], 'notifications.email' => ['boolean'], 'notifications.sms' => ['boolean'], 'notifications.whatsapp' => ['boolean']];
    }
}
