package com.zm.order.tool.server.handler.refund;


import com.zm.order.tool.server.enums.BizTypeEnum;
import com.zm.order.tool.server.model.Refund;
import com.zm.order.tool.server.model.refund.BaseIndexRefund;
import com.zm.order.tool.server.query.SearchRefundQuery;
import org.elasticsearch.search.SearchHit;
import org.elasticsearch.search.builder.SearchSourceBuilder;

import java.util.List;

/**
 * 退款单面向搜索引擎处理器
 *
 * <p>
 *
 * </p>
 *
 * @author nianchang
 * @date 2024/01/04 2:13 下午
 */
public interface RefundBusHandler extends BusinessHandleConst {

    /**
     * 业务类型
     *
     * <p>
     *
     * </p>
     *
     * @return {@link BizTypeEnum}
     */
    Integer bizType();

    /**
     * 构建索引对象
     *
     * <p>
     *
     * </p>
     *
     * @param refund datasource
     *
     * @return BaseIndexRefund
     */
    BaseIndexRefund buildIndex(Refund refund);

    /**
     * 解析索引文档
     *
     * <p>
     *
     * </p>
     *
     * @param searchHits searchHits
     *
     * @return BaseIndexRefund
     */
    List<BaseIndexRefund> parseIndex(SearchHit[] searchHits);

    /**
     * 组装搜索参数
     *
     * <p>
     *
     * </p>
     *
     * @param query query
     *
     * @return SearchSourceBuilder
     */
    SearchSourceBuilder buildSearchSourceBuilder(SearchRefundQuery query);
}
