package cn.axzo.workflow.client.feign.es;

import cn.axzo.workflow.client.annotation.WorkflowEngineFeignClient;
import cn.axzo.workflow.common.annotation.InvokeMode;
import cn.axzo.workflow.common.annotation.Manageable;
import cn.axzo.workflow.common.model.request.es.InstanceSearchReqDTO;
import cn.axzo.workflow.common.model.response.BpmPageResult;
import cn.axzo.workflow.common.model.response.es.ProcessInstanceDocumentVO;
import cn.azxo.framework.common.model.CommonResponse;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import static cn.axzo.workflow.common.enums.RpcInvokeModeEnum.SYNC;

/**
 * 操作 ES 的流程实例 API
 *
 * @author wangli
 * @since 2024-10-07 21:12
 */
@WorkflowEngineFeignClient
@Manageable
public interface EsProcessInstanceApi {

    /**
     * 从 ES 中搜索符合条件的实例纬度数据
     *
     * @param dto
     * @return
     */
    @PostMapping("/api/es/instance/search")
    @InvokeMode(SYNC)
    CommonResponse<BpmPageResult<ProcessInstanceDocumentVO>> searchInstanceInEs(@Validated @RequestBody InstanceSearchReqDTO dto);
}
