<?php

namespace Modules\Inventory\Http\Requests\Search;

use Illuminate\Foundation\Http\FormRequest;
use Modules\Core\Traits\FailedValidation;
use Modules\Core\Enums\SearchTypeEnum;
use Illuminate\Validation\Rule;

class ProductSearchRequest extends FormRequest
{
    use FailedValidation;

    /**
     * Get the validation rules that apply to the request.
     */
    public function rules(): array
    {
        return [
            'search' => ['nullable','string','max:100'],
            'type' => ['required', Rule::enum(SearchTypeEnum::class)]
        ];
    }

    /**
     * Determine if the user is authorized to make this request.
     */
    public function authorize(): bool
    {
        return true;
    }
}
