package com.lutao.cloud.oil.controller;

import com.lutao.cloud.common.core.util.MessageInfo;
import com.lutao.cloud.common.security.annotation.Inner;
import com.lutao.cloud.oil.pojo.vo.VideoEquipmentInfoTreeVO;
import com.lutao.cloud.oil.pojo.vo.VideoInfoNode;
import com.lutao.cloud.oil.runner.VideoInfoExecutor;
import com.lutao.cloud.oil.service.VideoEquipmentInfoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

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

@RestController
@RequestMapping("/video-equipment-info")
@Api(value = "/video-equipment-info",tags = "视频设备信息")
public class VideoEquipmentInfoController {

    @Resource
    private VideoEquipmentInfoService videoEquipmentInfoService;

    @Resource
    private VideoInfoExecutor videoInfoExecutor;

    @ApiOperation(value = "视频设备信息树")
    @PostMapping("/tree")
    @Inner(value = false)
    public MessageInfo<List<VideoEquipmentInfoTreeVO>> videoEquipmentInfoTree(){

        return videoEquipmentInfoService.queryVideoEquipmentInfoTree();
    }

    @ApiOperation(value = "树形视频设备信息-New")
    @PostMapping("/tree-new")
    @Inner(value = false)
    public MessageInfo<List<VideoInfoNode>> videoEquipmentInfoTreeNew(){

        return videoEquipmentInfoService.queryVideoEquipmentInfoTreeNew();
    }


    @ApiOperation(value = "手动请求视频设备信息")
    @PostMapping("/request-video-info")
    @Inner(value = false)
    public MessageInfo requestVideoInfo(){
        return videoInfoExecutor.executeManually();
        //return MessageInfo.ok();
    }


}
