<?php

declare(strict_types=1);

namespace Maestro\Core\Modules\Items\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

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

    /**
     * @return array<string, mixed>
     */
    public function rules(): array
    {
        return [
            'name' => ['sometimes', 'required', 'string', 'max:255'],
            'description' => ['nullable', 'string'],
            'default_unit_price_ex_vat' => ['sometimes', 'required', 'numeric', 'min:0'],
            'default_vat_rate_id' => ['nullable', 'exists:maestro_vat_rates,id'],
            'is_active' => ['sometimes', 'boolean'],
            'sort_order' => ['sometimes', 'integer', 'min:0'],
        ];
    }
}
