package cn.cslg.pas.controller;

/**
 * 检索历史的控制层
 * @Author xiexiang
 * @Date 2023/7/10
 */

import cn.cslg.pas.common.core.base.Constants;
import cn.cslg.pas.common.model.dto.RetrieveRecordDTO;
import cn.cslg.pas.common.model.outApi.RetrieveRecordDeDTO;
import cn.cslg.pas.common.model.outApi.RetrieveRecordQueryDTO;
import cn.cslg.pas.common.utils.Response;
import cn.cslg.pas.domain.RetrieveRecord;
import cn.cslg.pas.service.upLoadPatent.RetrieveRecordService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Tag(name = "无效理由和证据管理")
@Slf4j
@RequiredArgsConstructor
@RestController
@RequestMapping(Constants.API_VERSION_V2 + "/RetrieveRecord")
public class RetrieveRecordController {
    private final RetrieveRecordService retrieveRecordService;

    @Operation(summary = "添加检索历史")
    @PostMapping("/addRetrieveRecord")
    public String addRetrieveRecord(@RequestBody RetrieveRecordDTO retrieveRecordDTO){
        return Response.success(retrieveRecordService.addRetrieveRecord(retrieveRecordDTO));
    }

    @Operation(summary = "修改检索历史")
    @PostMapping("/updateRetrieveRecord")
    public String updateRetrieveRecord(@RequestBody RetrieveRecordDTO retrieveRecordDTO){
        return Response.success(retrieveRecordService.updateRetrieveRecord(retrieveRecordDTO));
    }

    @Operation(summary = "查询检索历史")
    @PostMapping("/queryRetrieveRecord")
    public String queryRetrieveRecord(@RequestBody RetrieveRecordQueryDTO retrieveRecordQueryDTO){
        return Response.success(retrieveRecordService.queryRetrieveRecord(retrieveRecordQueryDTO));
    }

    @Operation(summary = "删除检索历史")
    @PostMapping("/deleteRetrieveRecord")
    public String deleteRetrieveRecord(@RequestBody RetrieveRecordDeDTO retrieveRecordDeDTO){
        retrieveRecordService.deleteRetrieveRecord(retrieveRecordDeDTO);
        return Response.success("删除成功");
    }
}
