package com.fdkankan.scene.feign;

import com.fdkankan.common.response.ResultData;
import com.fdkankan.scene.api.vo.SceneCnt;
import com.fdkankan.scene.api.vo.SceneProDTO;
import com.fdkankan.scene.entity.ScenePro;
import com.fdkankan.scene.service.IUserSceneService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * 提供计算调用
 */
@RestController
@RequestMapping("/feign/user/scene")
@Slf4j
public class UserSceenFeign {

    @Autowired
    IUserSceneService userSceneService;

    @PostMapping("/getSceneCnt")
    ResultData<SceneCnt> getSceneCnt(@RequestParam(value = "userId") Long userId, Long cameraId){
        SceneCnt sceneCnt = userSceneService.getSceneCnt(userId, cameraId);
        return ResultData.ok(sceneCnt);
    }

    @PostMapping("/getSceneNumByCameraId")
    ResultData<Integer> getSceneNumByCameraId(@RequestParam(value = "cameraId") Long cameraId){
        return ResultData.ok(userSceneService.getSceneNumByCameraId(cameraId));
    }

    @PostMapping("/getLastSceneByCameraId")
    ResultData<SceneProDTO> getLastSceneByCameraId(@RequestParam(value = "cameraId") Long cameraId){
        return ResultData.ok(userSceneService.getLastSceneByCameraId(cameraId));
    }


}

