package com.ruoyi.platform.controller.aim;

import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.web.domain.GenericsAjaxResult;
import com.ruoyi.platform.service.AimService;
import com.ruoyi.platform.vo.InsMetricInfoVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("aim")
@Api("Aim管理")
public class AimController extends BaseController {

    @Resource
    private AimService aimService;


    @GetMapping("/getExpTrainInfos/{experiment_id}")
    @ApiOperation("获取当前实验的模型训练指标信息")
    @ApiResponse
    public AjaxResult getExpTrainInfos(@RequestParam(value = "page") int page,
                                       @RequestParam(value = "size") int size,
                                       @PathVariable("experiment_id") Integer experimentId) {
        return AjaxResult.success(aimService.getExpInfos(true, experimentId, page, size));
    }

    @GetMapping("/getExpEvaluateInfos/{experiment_id}")
    @ApiOperation("获取当前实验的模型推理指标信息")
    @ApiResponse
    public AjaxResult getExpEvaluateInfos(@RequestParam(value = "page") int page,
                                          @RequestParam(value = "size") int size,
                                          @PathVariable("experiment_id") Integer experimentId) {
        return AjaxResult.success(aimService.getExpInfos(false, experimentId, page, size));
    }

    @PostMapping("/getExpMetrics")
    @ApiOperation("获取当前实验的指标对比地址")
    @ApiResponse
    public GenericsAjaxResult<String> getExpMetrics(@RequestBody List<String> runIds) throws Exception {
        return genericsSuccess(aimService.getExpMetrics(runIds));
    }
}