package com.sz.admin.monitor.controller;

import com.sz.admin.monitor.pojo.dto.edgebox.AlarmReportDTO;
import com.sz.admin.monitor.pojo.po.AlgorithmTask;
import com.sz.admin.monitor.pojo.vo.cameraalarm.CameraAlarmVO;
import com.sz.admin.monitor.pojo.vo.edgebox.AlgorithmTaskVO;
import com.sz.admin.monitor.service.AlgorithmTaskService;
import com.sz.core.common.entity.ApiResult;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

/**
 * ClassName: AlgorithmTaskController
 * Package: com.sz.admin.monitor.controller
 * Description:
 */
@Tag(name = "算法任务")
@RestController
@RequestMapping("algorithm-task")
@RequiredArgsConstructor
public class AlgorithmTaskController {
  private final AlgorithmTaskService algorithmTaskService;
  // 根据摄像头id获取算法任务
  @Operation(summary = "根据摄像头id获取算法任务")
  @GetMapping("/get")
  public ApiResult<AlgorithmTaskVO> getAlgorithmTaskByCameraId(@RequestParam("cameraId") Long cameraId) {
        return ApiResult.success(algorithmTaskService.getAlgorithmTaskByCameraId(cameraId));
    }
  // 报警上报接口
  @Operation(summary = "报警上报接口")
  @PostMapping("/alarm")
  public ApiResult<CameraAlarmVO> alarmReport(@RequestBody AlarmReportDTO alarmReportDto) {
    return ApiResult.success(algorithmTaskService.alarmReport(alarmReportDto));
  }
}
