<?php

namespace Hura8\Interfaces;


interface iSearch
{
    /**
     * @description get filter fields
     * @param array[string]
     */
    public function getFilterFields(): array;

    /**
     * @description get fulltext fields
     * @param array[string]
     */
    public function getFulltextFields(): array;

    /**
     * @description update or create item if not exist
     * @param $item_id
     * @param array $table_field_values
        $table_field_values = [
            "tb_product.price" => 2000000,
            "tb_product.title" => "Máy tính ABC",
            "tb_category.price" => "Máy tính",
        ];
     * @return bool
     */
    public function updateItem($item_id, array $table_field_values = []): AppResponse;

    /**
     * @description delete item from index
     * @param $item_id
     */
    public function deleteItem($item_id): AppResponse;

    /**
     * @description delete items from index
     * @param $item_list_ids
     */
    public function deleteItems(array $item_list_ids): AppResponse;

    /**
     * @param string $keyword
     * @param array $field_filters
     * @param array $fulltext_fields
     * @param int $limit_result
     * @return array[int]
     */
    public function find(string $keyword, array $field_filters = [], array $fulltext_fields = [], int $limit_result = 2000) : array;

}
