package com.fdkankan.scene.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fdkankan.common.controller.BaseController;
import com.fdkankan.common.response.ResultData;
import com.fdkankan.scene.service.ISceneFileBuildService;
import com.fdkankan.scene.service.ISceneProAppService;
import com.fdkankan.scene.vo.BuildSceneParamVO;
import com.fdkankan.scene.vo.SceneParamVO;
import com.fdkankan.scene.vo.SceneVO;
import com.fdkankan.scene.vo.UserParamVO;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * Created by Hb_zzZ on 2019/6/10.
 */
@Log4j2
@RestController
@RequestMapping("/service/scene/app")
public class SceneAppController extends BaseController {

    @Autowired
    private ISceneProAppService sceneProAppService;
    @Autowired
    private ISceneFileBuildService sceneFileBuildService;

    /**
     * <p>
     获取相机的所有场景（分页）
     * </p>      
     * @author dengsixing
     * @date 2022/1/13 
     * @param param 
     *  <p>appUserName: 相机设备码</p>
     *  <p>appPassword: 相机密码</p>
     *  <p>phoneNum: 用户手机号</p>
     *  <p>cameraType: 1表示双目，4表示8目</p>
     *  <p>orderBy: 排序，如（create_time desc）</p>
     *  <p>sceneType：0表示其他，1表示文博，2表示地产，3表示电商，4表示餐饮，5表示家居</p>
     *  <p>sceneName: 场景名称，模糊搜索</p>
     *  <p>pageNum: 页码</p>
     *  <p>pageSize: 页大小</p>
     * @return com.fdkankan.common.response.ResultData<com.fdkankan.scene.vo.SceneVO>
     *     
     **/
    @PostMapping(value = "/getAppAllSceneByPage")
    public Page<SceneVO> getAllSceneByPage(@RequestBody UserParamVO param) throws Exception {
        return sceneProAppService.getAllSceneByPage(param);
    }

    /**
     * 获取相机的所有场景
     * @param user
     * @return
     */
    @PostMapping(value = "/getAllForCameraName")
    public List<SceneVO> getAllForCameraName(@RequestBody UserParamVO user){
        return sceneProAppService.getAllForCameraName(user);
    }

    /**
     * 获取相机的场景数量
     * @param user
     * @return
     */
    @PostMapping(value = "/getSceneCount")
    public Long getSceneCount(@RequestBody UserParamVO user) throws Exception {
        return sceneProAppService.getSceneCount(user);
    }

    /**
     * 获取场景的状态
     * @param user
     * @return
     */
    @PostMapping(value = "/getSceneStatus")
    public Integer getSceneStatus(@RequestBody UserParamVO user) throws Exception {
        return sceneProAppService.getSceneStatus(user);
    }

    /**
     * 获取8目场景的状态
     * @param user
     * @return
     */
    @PostMapping(value = "/getSceneStatusByUnicode")
    public Map<String, Object> getSceneStatusByUnicode(@RequestBody UserParamVO user) throws Exception {
        return sceneProAppService.getSceneStatusByUnicode(user);
    }

    /**
     * 删除某个场景
     * @param user
     * @return
     */
    @PostMapping(value = "/deleteForCameraName")
    public ResultData deleteForCameraName(@RequestBody UserParamVO user) throws Exception {
        return sceneProAppService.deleteForCameraName(user);
    }

    /**
     * app保存录屏音频文件
     * @param scene
     * @return
     */
    @PostMapping(value = "/getScreencapVoice")
    public ResultData getScreencapVoice(@RequestBody SceneParamVO scene) throws Exception {
        return sceneProAppService.getScreencapVoice(scene);
    }

    /**
     * app获取用户所有场景
     * @param user
     * @return
     */
    @PostMapping(value = "/getAllSceneByUserName")
    public List<SceneVO> getAllSceneByUserName(@RequestBody UserParamVO user) throws Exception {
        return sceneProAppService.getAllSceneByUserName(user);
    }

    /**
     * 场景建模
     */
    @PostMapping(value = "/buildScene")
    public ResultData buildScene(@RequestBody BuildSceneParamVO buildScene) throws Exception {
        return sceneFileBuildService.buildScene(buildScene);
    }

    /**
     * 协作的场景
     * @return
     */
    @PostMapping(value = "/cooperationSceneList")
    public ResultData cooperationSceneList(@RequestBody UserParamVO user) throws Exception{
        return sceneProAppService.cooperationSceneList(user);
    }


}
