package com.sz.admin.monitor.controller;

import com.sz.admin.monitor.pojo.vo.camerasnapshot.CameraSnapshotVO;
import com.sz.admin.monitor.service.CameraSnapshotService;
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.boot.actuate.endpoint.web.PathMappedEndpoints;
import org.springframework.context.annotation.Profile;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * ClassName: CameraSnapshotController
 * Package: com.sz.admin.monitor.controller
 * Description:
 */
@Tag(name = "摄像头抓图表")
@RestController
@RequestMapping("cameraSnapshot")
@RequiredArgsConstructor
@Profile({"dev", "local", "preview"})
public class CameraSnapshotController {
    private final CameraSnapshotService cameraSnapshotService;

    /**
     * 手动抓拍图片接口
     */
    @Operation(summary = "手动抓拍图片接口")
    @PostMapping("/capture/{id}")
    public ApiResult<CameraSnapshotVO> manualCapture(@PathVariable Long id) {
        CameraSnapshotVO cameraSnapshotVO = cameraSnapshotService.captureAndSave(id, 3);
        return ApiResult.success(cameraSnapshotVO);
    }
}
