<?php

declare(strict_types=1);

namespace Seka\Vzdelavanie\Http\Livewire\Components;

use Livewire\Component;
use Illuminate\Contracts\View\View;

/**
 * Class SearchText
 *
 * @package Seka\Vzdelavanie\Http\Livewire\Components
 */
final class SearchText extends Component
{
    /**
     * @var null
     */
    public $searchText = null;

    /**
     * @var string[]
     */
    protected $listeners = [
        'searchTextChanged',
    ];

    /**
     * @return \Illuminate\Contracts\View\View
     * @throws \Illuminate\Contracts\Container\BindingResolutionException
     */
    public function render(): View
    {
        return view('Vzdelavanie::livewire.components.searchtext');
    }

    /**
     * @param $value
     */
    public function updatedSearchText($value)
    {
        $this->emitTo('Vzdelavanie::pages.sprava.testovanie.pouzivatelia.components.zoznam', 'filterByText', $value);
    }
}
