package com.yutou.bilibili.Controllers;

import com.alibaba.fastjson2.JSONObject;
import com.yutou.biliapi.bean.live.LiveRoomConfig;
import com.yutou.biliapi.net.WebSocketManager;
import com.yutou.bilibili.datas.ResultData;
import com.yutou.bilibili.datas.ReturnCode;
import com.yutou.bilibili.services.LiveDanmuService;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class LiveDanmuController {
    @Resource
    LiveDanmuService service;

    @ResponseBody
    @RequestMapping("/live/danmu/list")
    public JSONObject getLiveDanmuList() {
        return ResultData.success(service.getLiveRoomList());
    }

    @ResponseBody
    @RequestMapping("/live/danmu/stop")
    public JSONObject stopLiveDanmu(String roomId) {
        service.stop(roomId, true);
        return ResultData.success(ReturnCode.RC100);
    }

    @ResponseBody
    @RequestMapping("/live/danmu/start")
    public JSONObject startLiveDanmu(String roomId) {
        service.start(roomId, true);
        return ResultData.success(ReturnCode.RC100);
    }

    @ResponseBody
    @RequestMapping("/live/danmu/file/list")
    public JSONObject getDanmuList(String roomId) {
        return ResultData.success(ReturnCode.RC100);
    }

    @ResponseBody
    @RequestMapping("/live/danmu/get")
    public JSONObject getDanmu(String roomId, String videoId) {
        return ResultData.success(service.getDanmu(roomId, videoId));
    }
}
