package com.crunii.micro.feign.client;

import com.crunii.micro.common.dto.PageReq;
import com.crunii.micro.common.dto.PageRsp;
import com.crunii.micro.common.dto.Result;
import com.crunii.micro.feign.client.dto.*;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.io.IOException;
import java.util.List;

/**
 * @author: LG
 * @date: 2023/6/8 15:42
 */
@FeignClient(value = "service-elstic")
public interface ElsticService {

    @ApiOperation(value = "标签保存")
    @RequestMapping(path = "/auth/labelESController/save", method = RequestMethod.POST)
    Result<?> saveLabel(@RequestBody LabelDto dto);

    @ApiOperation(value = "批量保存标签")
    @RequestMapping(path = "/auth/labelESController/batchSave", method = RequestMethod.POST)
    Result<?> batchSaveLabel(@RequestBody List<LabelDto> dto);

    @ApiOperation(value = "标签搜索")
    @RequestMapping(path = "/auth/labelESController/search", method = RequestMethod.GET)
    Result<List<LabelDto>> queryLabel(String searchText);

    @ApiOperation(value = "标签删除")
    @RequestMapping(path = "/auth/labelESController/del", method = RequestMethod.GET)
    Result<?> delLabel(@RequestParam("id") String id);


    @ApiOperation(value = "文件ES保存")
    @RequestMapping(path = "/auth/fileESController/save", method = RequestMethod.POST)
    Result<?> saveFile(@RequestBody ElsticFileDto dto);

    @ApiOperation(value = "批量保存文件")
    @RequestMapping(path = "/auth/fileESController/batchSave", method = RequestMethod.POST)
    Result<?> batchSaveFile(@RequestBody List<ElsticFileDto> dto);

    @ApiOperation(value = "文件搜索")
    @RequestMapping(path = "/auth/fileESController/search", method = RequestMethod.GET)
    Result<List<ElsticFileDto>> queryFile(@RequestParam("searchText") String searchText);

    @ApiOperation("分页搜索ES中的数据")
    @RequestMapping(path = "/auth/fileESController/pageSearch", method = RequestMethod.POST)
    Result<PageRsp<ElsticFileDto>> query(@RequestBody PageReq<FileElsticPageDto> dtoPageReq);

    @ApiOperation(value = "文件删除")
    @RequestMapping(path = "/auth/fileESController/del", method = RequestMethod.GET)
    Result<?> delFile(@RequestParam("id") String id);

    @ApiOperation("修改ES中的数据")
    @PostMapping("/auth/fileESController/batchUpdate")
    Result<?> batchUpdate(@RequestBody List<ElsticFileDto> dtos);

    @ApiOperation(value = "青年热点-ES保存")
    @RequestMapping(path = "/auth/YouthHotEsController/saveYouthHot", method = RequestMethod.POST)
    Result<?> saveYouthHot(@RequestBody YouthHotEsVo dto);

    @ApiOperation("青年热点-分页搜索ES中的数据")
    @RequestMapping(path = "/auth/YouthHotEsController/pageSearchYouthHot", method = RequestMethod.POST)
    Result<PageRsp<YouthHotEsVo>> pageSearchYouthHot(@RequestBody PageReq<HotEsPageDto> dtoPageReq);

    @ApiOperation(value = "青年热点-文件删除")
    @RequestMapping(path = "/auth/YouthHotEsController/delYouthHot", method = RequestMethod.GET)
    Result<?> delYouthHot(@RequestParam("id") String id);

    @ApiOperation(value = "APP消息中心-ES-新增")
    @RequestMapping(path = "/auth/appMessageEs/saveEs", method = RequestMethod.POST)
    Result<?> saveEs(@RequestBody MessageSendSelect dto);

    @ApiOperation("APP消息中心-ES-分页搜索ES中的数据")
    @RequestMapping(path = "/auth/appMessageEs/pageSearchEs", method = RequestMethod.POST)
    Result<PageRsp<MessageSendSelect>> pageSearchEs(@RequestBody PageReq<AppMessageCenterDTO> dtoPageReq);

    @ApiOperation(value = "APP消息中心-ES-删除ES中的数据")
    @RequestMapping(path = "/auth/appMessageEs/delEs", method = RequestMethod.GET)
    Result<?> delEs(@RequestParam("id") String id);

}
