package com.fdkankan.scene.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fdkankan.common.controller.BaseController;
import com.fdkankan.common.response.PageInfo;
import com.fdkankan.common.response.ResultData;
import com.fdkankan.scene.service.IUserSceneService;
import com.fdkankan.scene.vo.SceneParamVO;
import com.fdkankan.scene.vo.SceneVO;
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.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * 个人中心-我的场景
 */
@Log4j2
@RestController
@RequestMapping("/api/scene/user/scene")
public class UserSceneController extends BaseController {

    @Autowired
    private IUserSceneService userSceneService;
    /**
     * 获取用户场景记录
     * pageNum          分页
     * searchKey        搜索条件
     * pageSize         每页大小
     */
    @RequestMapping(value = "/list", method = RequestMethod.POST)
    public Page<SceneVO> getScenes(@RequestBody SceneParamVO param) throws Exception {
        return userSceneService.getScenes(getToken(), param);

    }

    /**
     * 获取我的场景和协作场景数量
     * @return
     */
    @PostMapping(value = "/findSceneNumber")
    public ResultData findSceneNumber(String snCode) throws Exception{
        Long userId = this.getUserId();
        return userSceneService.findSceneNumber(userId, snCode);
    }

    /**
     * 获取用户场景记录
     * @param param
     * @return
     */
//    @ApiOperation("获取用户场景列表-文件夹形式")
    @RequestMapping(value = "/newList", method = RequestMethod.POST)
//    @ApiImplicitParams({
//        @ApiImplicitParam(name = "pageNum", value = "分页", dataType = "number"),
//        @ApiImplicitParam(name = "sceneSource", value = "0表示看看，1表示看见", dataType = "number"),
//        @ApiImplicitParam(name = "sceneType", value = "场景类型,0表示其他，1表示文博，2表示地产，3表示电商，4表示餐饮，5表示家居", dataType = "number"),
//        @ApiImplicitParam(name = "startTime", value = "开始时间", dataType = "String"),
//        @ApiImplicitParam(name = "endTime", value = "结束时间", dataType = "String"),
//        @ApiImplicitParam(name = "folderId", value = "文件夹id,根目录则不用传", dataType = "number"),
//        @ApiImplicitParam(name = "folderType", value = "文件夹类型，根目录传，0我的场景，1协作场景", dataType = "number"),
//        @ApiImplicitParam(name = "pageSize", value = "每页大小", dataType = "number")})
    public ResultData<PageInfo<SceneVO>> getNewScenes(@RequestBody SceneParamVO param) throws Exception {
        param.setUserId(this.getUserId());
        return userSceneService.getNewScenes( param);
    }



}
