<?php

namespace Mibazarow\Bxstore\Controller\Web;

use Bitrix\Main\Engine\Controller;
use Bitrix\Main\Engine\Response\Render\Component;

/**
 * Контроллер поиска.
 */
class SearchController extends Controller
{
    protected function getDefaultPreFilters(): array
    {
        return [];
    }

    /**
     * Поиск по объявлениям.
     * Маршрут: /search/
     */
    public function indexAction(): Component
    {
        global $APPLICATION;
        $APPLICATION->SetTitle('Поиск по объявлениям');

        return $this->renderComponent('bitrix:catalog.search', 'search_page', [
            'ACTION_VARIABLE' => 'action',
            'AJAX_MODE' => 'N',
            'AJAX_OPTION_ADDITIONAL' => '',
            'AJAX_OPTION_HISTORY' => 'N',
            'AJAX_OPTION_JUMP' => 'N',
            'AJAX_OPTION_STYLE' => 'Y',
            'BASKET_URL' => '',
            'CACHE_TIME' => '36000000',
            'CACHE_TYPE' => 'A',
            'CHECK_DATES' => 'Y',
            'CONVERT_CURRENCY' => 'N',
            'DETAIL_URL' => '',
            'DISPLAY_BOTTOM_PAGER' => 'Y',
            'DISPLAY_COMPARE' => 'N',
            'DISPLAY_TOP_PAGER' => 'N',
            'ELEMENT_SORT_FIELD' => 'sort',
            'ELEMENT_SORT_FIELD2' => 'id',
            'ELEMENT_SORT_ORDER' => 'asc',
            'ELEMENT_SORT_ORDER2' => 'desc',
            'HIDE_NOT_AVAILABLE' => 'N',
            'HIDE_NOT_AVAILABLE_OFFERS' => 'N',
            'IBLOCK_ID' => '14',
            'IBLOCK_TYPE' => 'catalog2',
            'LINE_ELEMENT_COUNT' => '3',
            'NO_WORD_LOGIC' => 'N',
            'OFFERS_LIMIT' => '5',
            'PAGER_DESC_NUMBERING' => 'N',
            'PAGER_DESC_NUMBERING_CACHE_TIME' => '36000',
            'PAGER_SHOW_ALL' => 'N',
            'PAGER_SHOW_ALWAYS' => 'N',
            'PAGER_TEMPLATE' => 'round',
            'PAGER_TITLE' => 'Товары',
            'PAGE_ELEMENT_COUNT' => '30',
            'PRICE_CODE' => ['BASE'],
            'PRICE_VAT_INCLUDE' => 'Y',
            'PRODUCT_ID_VARIABLE' => 'id',
            'PRODUCT_PROPERTIES' => '',
            'PRODUCT_PROPS_VARIABLE' => 'prop',
            'PRODUCT_QUANTITY_VARIABLE' => 'quantity',
            'PROPERTY_CODE' => ['', ''],
            'RESTART' => 'Y',
            'SECTION_ID_VARIABLE' => 'SECTION_ID',
            'SECTION_URL' => '',
            'SHOW_PRICE_COUNT' => '1',
            'USE_LANGUAGE_GUESS' => 'Y',
            'USE_PRICE_COUNT' => 'N',
            'USE_PRODUCT_QUANTITY' => 'N',
            'USE_SEARCH_RESULT_ORDER' => 'N',
            'USE_TITLE_RANK' => 'Y',
            'COMPONENT_TEMPLATE' => '.default',
        ]);
    }
}
