package com.fdkankan.ucenter.controller.api;

import com.alibaba.fastjson.JSONObject;
import com.fdkankan.ucenter.common.BaseController;
import com.fdkankan.ucenter.common.Result;
import com.fdkankan.ucenter.service.IScenePlusVoidService;
import com.fdkankan.ucenter.vo.request.SceneParam;
import com.fdkankan.ucenter.vo.response.ScenePlusVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 随心装调用
 */

@RestController
@RequestMapping("/ucenter/void")
public class VoidController extends BaseController {

    @Autowired
    IScenePlusVoidService scenePlusVoidService;
    /**
     * 记录虚拟场景计算状态
     * type  0开始计算
     * type  1计算完成
     * type  2计算失败
     */
    @GetMapping("/scene/status")
    public Result setStatus(@RequestParam(required = false) String  num,
                            @RequestParam(required = false) Integer type){

        scenePlusVoidService.setStatus(num,type,getToken());
        return Result.success();
    }

    /**
     * 只需获取v4场景数据,无需文件夹
     */
    @PostMapping("/scene/list")
    public Result sceneList(@RequestBody SceneParam param){
        List<ScenePlusVo> scenePlusVos = scenePlusVoidService.scenePageList(param,getToken() );
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("list",scenePlusVos);
        return Result.success(jsonObject);
    }
}
