<?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 StoreOfferCatalogItemRequest extends FormRequest
{
    public function authorize(): bool
    {
        return true;
    }

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