package com.platform.modules.live.controller;

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

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.platform.common.utils.R;
import com.platform.modules.live.constants.SceneConstants;
import com.platform.modules.live.service.LiveSceneService;
import com.platform.modules.live.vo.SceneEntityVo;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import springfox.documentation.annotations.ApiIgnore;

/**
 * Description:
 * Author:zj
 * Date:2019/3/1 16:53
 */
@RestController
@RequestMapping("/homepage")
@Api(value = "首页", tags = "首页")
public class HomepageController {

    @Autowired
    private LiveSceneService liveSceneService;

    @GetMapping("/recentLiveReport")
//    @RequiresPermissions("live:livescene:recentScene")
    @ApiOperation(value = "现场直播", produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiImplicitParams({
            @ApiImplicitParam(value = "显示条数", name = "limit", defaultValue = "5", paramType = "query", dataType = "int"),
            @ApiImplicitParam(value = "现场类型，1:视频现场,2:音频现场,3:图片现场,4:文字现场,5:混合现场,6:精品现场", name = "sceneType", paramType = "query", dataType = "int"),})
    public R recentLiveReport(@ApiIgnore @RequestParam(required = false) Map<String, Object> params){
        params.put("liveState", SceneConstants.LIVE_STATE_DIRECT);
        List<SceneEntityVo> list = liveSceneService.recentLiveReport(params);
        return R.ok().put("result", list);
    }


    @GetMapping("/recentScene")
//    @RequiresPermissions("live:livescene:recentScene")
    @ApiOperation(value = "近期现场", produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiImplicitParams({
            @ApiImplicitParam(value = "显示条数", name = "limit", defaultValue = "4", paramType = "query", dataType = "int"),
            @ApiImplicitParam(value = "现场类型，1:视频现场,2:音频现场,3:图片现场,4:文字现场,5:混合现场,6:精品现场", name = "sceneType", paramType = "query", dataType = "int"),})
    public R recentScene(@ApiIgnore @RequestParam(required = false) Map<String, Object> params){
        //回顾
        params.put("liveState", SceneConstants.LIVE_STATE_REVIEW);
        List<SceneEntityVo> list = liveSceneService.recentScene(params);
        return R.ok().put("result", list);
    }

}
