package org.wcs.serve.controller.app;

import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import org.wcs.model.dto.serve.recordApi.QueryRecordApiRequestReq;
import org.wcs.model.dto.serve.recordApi.QueryRecordApiResponseReq;
import org.wcs.model.vo.serve.AppServeDataResponse;
import org.wcs.model.vo.serve.common.PageDataResponse;
import org.wcs.model.vo.serve.recordApi.RecordApiRequestVo;
import org.wcs.model.vo.serve.recordApi.RecordApiResponseVo;
import org.wcs.serve.service.intf.IRecordApiService;

/**
 * API 请求记录控制器
 */
@RestController
@RequestMapping("/app/recordApi")
@ResponseBody
@RequiredArgsConstructor
public class RecordApiController {

    private final IRecordApiService recordApiRequestService;

    /**
     * 查询 API 请求记录
     * @param request 查询参数
     * @param pageSize 每页数量
     * @param pageIndex 页码
     * @return 查询结果
     */
    @PostMapping("/queryApiRequestWithPage")
    public AppServeDataResponse<PageDataResponse<RecordApiRequestVo>> queryRecordApiRequest(@RequestBody QueryRecordApiRequestReq request, @RequestParam("pageSize") Integer pageSize, @RequestParam("pageIndex") Integer pageIndex) {
        return recordApiRequestService.queryRecordApiRequest(request, pageSize, pageIndex);
    }

    /**
     * 获取 API 响应记录
     * @param request 查询参数
     * @param pageSize 每页数量
     * @param pageIndex 页码
     * @return 查询结果
     */
    @PostMapping("/queryApiResponseWithPage")
    public AppServeDataResponse<PageDataResponse<RecordApiResponseVo>> queryRecordApiResponse(@RequestBody QueryRecordApiResponseReq request, @RequestParam("pageSize") Integer pageSize, @RequestParam("pageIndex") Integer pageIndex) {
        return recordApiRequestService.queryRecordApiResponse(request, pageSize, pageIndex);
    }






}
