<?php

namespace App\Modules\Tenant\Requests;

use Illuminate\Foundation\Http\FormRequest;

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

    /**
     * @return array<string, list<string>>
     */
    public function rules(): array
    {
        return [
            'name' => ['required', 'string', 'max:255'],
            'email' => ['nullable', 'email', 'max:255'],
            'phone' => ['nullable', 'string', 'max:50'],
            'address' => ['nullable', 'string'],
            'currency' => ['required', 'string', 'size:3'],
            'timezone' => ['required', 'string', 'max:100'],
            'settings' => ['nullable', 'array'],
            'settings.default_tax_rate' => ['nullable', 'numeric', 'min:0', 'max:100'],
            'settings.invoice_prefix' => ['nullable', 'string', 'max:20'],
            'settings.pos_prefix' => ['nullable', 'string', 'max:20'],
            'settings.purchase_prefix' => ['nullable', 'string', 'max:20'],
            'settings.expense_prefix' => ['nullable', 'string', 'max:20'],
            'settings.payment_terms_days' => ['nullable', 'integer', 'min:0', 'max:365'],
            'settings.low_stock_alerts' => ['nullable', 'boolean'],
            'settings.invoice_due_alerts' => ['nullable', 'boolean'],
            'settings.crm_follow_up_alerts' => ['nullable', 'boolean'],
        ];
    }
}
