<?php

declare(strict_types=1);

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

use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;
use Maestro\Core\Modules\Offers\Enums\OfferPricingType;

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

    /**
     * @return array<string, mixed>
     */
    public function rules(): array
    {
        return [
            'name' => ['sometimes', 'string', 'max:255'],
            'default_description' => ['sometimes', 'nullable', 'string'],
            'default_pricing_type' => ['sometimes', 'string', Rule::enum(OfferPricingType::class)],
            'default_custom_unit_label' => ['sometimes', 'nullable', 'string', 'max:80'],
            'default_unit_price' => ['sometimes', 'numeric'],
            'default_quantity' => ['sometimes', 'numeric'],
            'default_vat_rate' => ['sometimes', 'numeric'],
            'is_active' => ['sometimes', 'boolean'],
        ];
    }
}
