package com.platform.modules.live.controller;

import java.util.List;

import com.platform.modules.live.aspect.CasterTenant;
import com.platform.modules.live.vo.CasterComponentVo;
import com.platform.modules.live.vo.CasterLayoutVo;
import com.platform.modules.live.vo.CasterSceneAudioVo;
import com.platform.modules.live.vo.CasterSceneConfigVo;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
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 com.platform.common.annotation.SysLog;
import com.platform.modules.live.service.CasterService;
import com.platform.modules.live.service.LiveSceneLiveInfoExtService;
import com.platform.plugs.common.rpc.RpcResponse;
import com.platform.plugs.live.LiveClient;
import com.platform.plugs.live.responseEntity.Caster;
import com.platform.plugs.live.responseEntity.CasterComponent;
import com.platform.plugs.live.responseEntity.CasterConfig;
import com.platform.plugs.live.responseEntity.CasterLayout;
import com.platform.plugs.live.responseEntity.CasterScenes;
import com.platform.plugs.live.responseEntity.CasterStream;
import com.platform.plugs.live.responseEntity.CasterVideoResource;
import com.platform.plugs.live.responseEntity.StartCaster;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;

/**
 * @Description:
 * @Author: yikaihong
 * @CreateDate: 2019/1/19 15:01
 * @Version: 1.0
 */
@RestController
@RequestMapping("/caster")
@Api(value = "导播台服务管理", tags = "导播台服务管理")
public class CasterController {

    @Autowired
    private LiveClient liveClient;
    @Autowired
    private LiveSceneLiveInfoExtService liveSceneLiveInfoExtService;
    
    @SysLog("创建并初始化导播台")
    @PostMapping("/createCasterAndInitCasterConfig")
    @ApiOperation("创建并初始化导播台")
    @RequiresPermissions("live:caster:all")
    public RpcResponse createCasterAndInitCasterConfig(){
    	return liveClient.liveCaster().createCasterAndInitCasterConfig();
    }

    @GetMapping("/describeCasterConfig")
    @ApiOperation("获取导播台配置")
    @RequiresPermissions("live:caster:all")
    @ApiImplicitParams({
            @ApiImplicitParam(value = "导播台Id", name = "casterId", paramType = "query", required = true, dataType = "String")})
    public RpcResponse describeCasterConfig(String casterId){
        return liveClient.liveCaster().describeCasterConfig(casterId);
    }

    @SysLog("删除导播台")
    @PostMapping("/deleteCaster")
    @ApiOperation("删除导播台")
    @ApiImplicitParams({
        @ApiImplicitParam(value = "导播台Id。", name = "casterId", paramType = "query", required = true, dataType = "String")})
    @RequiresPermissions("live:caster:all")
    public RpcResponse deleteCaster(String casterId){
    	return liveClient.liveCaster().deleteCaster(casterId);
    }
    
    @GetMapping("/describeCaster")
    @ApiOperation("查询导播台")
    @ApiImplicitParams({
        @ApiImplicitParam(value = "导播台Id。", name = "casterId", paramType = "query", required = true, dataType = "String")})
    @RequiresPermissions("live:caster:all")
    public RpcResponse<Caster> describeCaster(String casterId){
    	return liveClient.liveCaster().describeCaster(casterId);
    }
    
    @SysLog("配置导播台，全量覆盖配置信息，若指定参数置为空则清除导播台该项配置。")
    @PostMapping("/setCasterConfig")
    @ApiOperation("配置导播台，全量覆盖配置信息，若指定参数置为空则清除导播台该项配置。")
    @RequiresPermissions("live:caster:all")
    @CasterTenant
    public RpcResponse setCasterConfig(@RequestBody CasterConfig config){
    	return liveClient.liveCaster().setCasterConfig(config);
    }

    @SysLog("启动导播台，若PVW、PGM场景不存在则创建，启动PVW、PGM场景，启动底层音视频处理任务。")
    @PostMapping("/startCaster")
    @ApiOperation("启动导播台，若PVW、PGM场景不存在则创建，启动PVW、PGM场景，启动底层音视频处理任务。")
    @ApiImplicitParams({
        @ApiImplicitParam(value = "导播台Id。", name = "casterId", paramType = "query", required = true, dataType = "String")})
    @RequiresPermissions("live:caster:all")
    @CasterTenant
    public RpcResponse<StartCaster> startCaster(String casterId){
    	return liveClient.liveCaster().startCaster(casterId);
    }
    
    @SysLog("停止导播台，停止PVW、PGM场景，清理输出配置，停止底层音视频处理任务。")
    @PostMapping("/stopCaster")
    @ApiOperation("停止导播台，停止PVW、PGM场景，清理输出配置，停止底层音视频处理任务。")
    @ApiImplicitParams({
        @ApiImplicitParam(value = "导播台Id。", name = "casterId", paramType = "query", required = true, dataType = "String")})
    @RequiresPermissions("live:caster:all")
    @CasterTenant
    public RpcResponse stopCaster(String casterId){
    	return liveClient.liveCaster().stopCaster(casterId);
    }
    
    @GetMapping("/describeCasterScenes")
    @ApiOperation("查询场景信息列表，预监和用户场景列表")
    @ApiImplicitParams({
        @ApiImplicitParam(value = "导播台Id。", name = "casterId", paramType = "query", required = true, dataType = "String"),
        @ApiImplicitParam(value = "场景id。", name = "sceneId", paramType = "query", required = false, dataType = "String")})
    @RequiresPermissions("live:caster:all")
    public RpcResponse<CasterScenes> describeCasterScenes(String casterId, String sceneId){
    	return liveClient.liveCaster().describeCasterScenes(casterId,sceneId);
    }

    @GetMapping("/copyCasterSceneConfig")
    @ApiOperation("将原场景配置应用至目标场景并生效，仅限PVW场景配置拷贝至PGM场景")
    @ApiImplicitParams({
        @ApiImplicitParam(value = "导播台Id。", name = "casterId", paramType = "query", required = true, dataType = "String"),
        @ApiImplicitParam(value = "原场景ID，仅限于PVM场景。", name = "fromSceneId", paramType = "query", required = true, dataType = "String"),
        @ApiImplicitParam(value = "目标场景ID，仅限于PGM场景。", name = "toSceneId", paramType = "query", required = true, dataType = "String")})
    @RequiresPermissions("live:caster:all")
    @CasterTenant
    public RpcResponse copyCasterSceneConfig(String casterId, String fromSceneId, String toSceneId){
    	return liveClient.liveCaster().copyCasterSceneConfig(casterId, fromSceneId, toSceneId);
    }
    
    @SysLog("全量设置场景配置，清空场景配置，并将布局信息设置并生效至指定场景")
    @PostMapping("/setCasterSceneConfig")
    @ApiOperation("全量设置场景配置，清空场景配置，并将布局信息设置并生效至指定场景")
    @ApiImplicitParams({
        @ApiImplicitParam(value = "场景配置", name = "CasterSceneConfigVo", paramType = "query", required = true, dataType = "json")})
    @RequiresPermissions("live:caster:all")
    @CasterTenant
    public RpcResponse setCasterSceneConfig(@RequestBody CasterSceneConfigVo casterSceneConfig){
    	return liveClient.liveCaster().setCasterSceneConfig(casterSceneConfig.getCasterId(), casterSceneConfig.getSceneId(), casterSceneConfig.getLayoutId(), casterSceneConfig.getComponentIds());
    }
    
    @SysLog("增量设置场景配置，不清空原配置，布局信息在原场景上增量修改，效率较全量设置高")
    @PostMapping("/updateCasterSceneConfig")
    @ApiOperation("增量设置场景配置，不清空原配置，布局信息在原场景上增量修改，效率较全量设置高")
    @ApiImplicitParams({
        @ApiImplicitParam(value = "场景配置", name = "CasterSceneConfigVo", paramType = "query", required = true, dataType = "json")})
    @RequiresPermissions("live:caster:all")
    @CasterTenant
    public RpcResponse updateCasterSceneConfig(@RequestBody CasterSceneConfigVo casterSceneConfig){

    	return liveClient.liveCaster().updateCasterSceneConfig(casterSceneConfig.getCasterId(), casterSceneConfig.getSceneId(), casterSceneConfig.getLayoutId(), casterSceneConfig.getComponentIds());
    }
    
    @SysLog("清除指定场景配置信息")
    @PostMapping("/deleteCasterSceneComponentConfig")
    @ApiOperation("清除指定场景配置信息")
    @ApiImplicitParams({
        @ApiImplicitParam(value = "导播台Id。", name = "casterId", paramType = "query", required = true, dataType = "String"),
        @ApiImplicitParam(value = "场景ID。", name = "sceneId", paramType = "query", required = true, dataType = "String")})
    @RequiresPermissions("live:caster:all")
    @CasterTenant
    public RpcResponse deleteCasterSceneComponentConfig(String casterId, String sceneId){
    	return liveClient.liveCaster().deleteCasterSceneComponentConfig(casterId, sceneId);
    }
    
    @SysLog("清除指定场景配置信息")
    @PostMapping("/deleteCasterSceneLayoutConfig")
    @ApiOperation("清除指定场景配置信息")
    @ApiImplicitParams({
        @ApiImplicitParam(value = "导播台Id。", name = "casterId", paramType = "query", required = true, dataType = "String"),
        @ApiImplicitParam(value = "场景ID。", name = "sceneId", paramType = "query", required = true, dataType = "String")})
    @RequiresPermissions("live:caster:all")
    @CasterTenant
    public RpcResponse deleteCasterSceneLayoutConfig(String casterId, String sceneId){
    	return liveClient.liveCaster().deleteCasterSceneLayoutConfig(casterId, sceneId);
    }
    
    @SysLog("清除指定场景配置信息")
    @PostMapping("/deleteCasterSceneAllConfig")
    @ApiOperation("清除指定场景配置信息")
    @ApiImplicitParams({
        @ApiImplicitParam(value = "导播台Id。", name = "casterId", paramType = "query", required = true, dataType = "String"),
        @ApiImplicitParam(value = "场景ID。", name = "sceneId", paramType = "query", required = true, dataType = "String")})
    @RequiresPermissions("live:caster:all")
    @CasterTenant
    public RpcResponse deleteCasterSceneAllConfig(String casterId, String sceneId){
    	return liveClient.liveCaster().deleteCasterSceneAllConfig(casterId, sceneId);
    }
    
    @SysLog("启动指定场景，限制仅用于PVW的打开")
    @PostMapping("/startCasterScene")
    @ApiOperation("启动指定场景，限制仅用于PVW的打开")
    @ApiImplicitParams({
        @ApiImplicitParam(value = "导播台Id。", name = "casterId", paramType = "query", required = true, dataType = "String"),
        @ApiImplicitParam(value = "场景ID。", name = "sceneId", paramType = "query", required = true, dataType = "String")})
    @RequiresPermissions("live:caster:all")
    @CasterTenant
    public RpcResponse<String> startCasterScene(String casterId, String sceneId){
    	return liveClient.liveCaster().startCasterScene(casterId, sceneId);
    }
    
    @SysLog("停止指定场景，限制仅用于PVW的关闭。")
    @PostMapping("/stopCasterScene")
    @ApiOperation("停止指定场景，限制仅用于PVW的关闭。")
    @ApiImplicitParams({
        @ApiImplicitParam(value = "导播台Id。", name = "casterId", paramType = "query", required = true, dataType = "String"),
        @ApiImplicitParam(value = "场景ID。", name = "sceneId", paramType = "query", required = true, dataType = "String")})
    @RequiresPermissions("live:caster:all")
    @CasterTenant
    public RpcResponse stopCasterScene(String casterId, String sceneId){
    	return liveClient.liveCaster().stopCasterScene(casterId, sceneId);
    }
    
    @SysLog("更新场景音频配置。")
    @PostMapping("/updateCasterSceneAudio")
    @ApiOperation("更新场景音频配置。")
    @ApiImplicitParams({
        @ApiImplicitParam(value = "音频设置", name = "CasterSceneAudioVo", paramType = "query", required = true, dataType = "Json")})
    @RequiresPermissions("live:caster:all")
    @CasterTenant
    public RpcResponse updateCasterSceneAudio(@RequestBody CasterSceneAudioVo casterSceneAudio){
    	return liveClient.liveCaster().updateCasterSceneAudio(casterSceneAudio.getCasterId(), casterSceneAudio.getSceneId(), casterSceneAudio.getFollowEnable(), casterSceneAudio.getAudioLayers(), casterSceneAudio.getMixList());
    }
    
    @GetMapping("/describeCasterSceneAudio")
    @ApiOperation("查询场景音频配置信息。")
    @ApiImplicitParams({
        @ApiImplicitParam(value = "导播台Id。", name = "casterId", paramType = "query", required = true, dataType = "String"),
        @ApiImplicitParam(value = "场景ID。", name = "sceneId", paramType = "query", required = true, dataType = "String")})
    @RequiresPermissions("live:caster:all")
    public RpcResponse describeCasterSceneAudio(String casterId, String sceneId){
    	return liveClient.liveCaster().describeCasterSceneAudio(casterId, sceneId);
    }
    
    @SysLog("添加视频源，视频源数量受限于导播台输入路数")
    @PostMapping("/addCasterVideoResource")
    @ApiOperation("添加视频源，视频源数量受限于导播台输入路数")
    @ApiImplicitParams({
        @ApiImplicitParam(value = "导播台Id。", name = "casterId", paramType = "query", required = true, dataType = "String"),
        @ApiImplicitParam(value = "视频源名称。", name = "resourceName", paramType = "query", required = true, dataType = "String"),
        @ApiImplicitParam(value = "用于标志视频源位置，定义布局内画面的引用编号，每个位置至多关联一个资源，格式需符合“RV01…RV12”。", name = "locationId", paramType = "query", required = true, dataType = "String")})
    @RequiresPermissions("live:caster:all")
    @CasterTenant
    public RpcResponse<CasterVideoResource> addCasterVideoResource(String casterId, String resourceName, String locationId){
    	return liveClient.liveCaster().addCasterVideoResource(casterId, resourceName, locationId);
    }
    
    @SysLog("添加视频源，视频源数量受限于导播台输入路数")
    @PostMapping("/addCasterVideoLiveStreamResource")
    @ApiOperation("添加视频源，视频源数量受限于导播台输入路数。")
    @ApiImplicitParams({
        @ApiImplicitParam(value = "导播台Id。", name = "casterId", paramType = "query", required = true, dataType = "String"),
        @ApiImplicitParam(value = "视频源名称。", name = "resourceName", paramType = "query", required = true, dataType = "String"),
        @ApiImplicitParam(value = "用于标志视频源位置，定义布局内画面的引用编号，每个位置至多关联一个资源，格式需符合“RV01…RV12”。", name = "locationId", paramType = "query", required = true, dataType = "String"),
        @ApiImplicitParam(value = "直播流地址，视频源类型为直播流时必输。", name = "liveStreamUrl", paramType = "query", required = true, dataType = "String")})
    @RequiresPermissions("live:caster:all")
    @CasterTenant
    public RpcResponse<CasterVideoResource> addCasterVideoLiveStreamResource(String casterId, String resourceName, String locationId, String liveStreamUrl){
    	return liveClient.liveCaster().addCasterVideoLiveStreamResource(casterId, resourceName, locationId, liveStreamUrl);
    }
    
    @SysLog("删除视频源")
    @PostMapping("/deleteCasterVideoResource")
    @ApiOperation("删除视频源")
    @ApiImplicitParams({
            @ApiImplicitParam(value = "导播台Id。", name = "casterId", paramType = "query", required = true, dataType = "String"),
            @ApiImplicitParam(value = "视频源Id。", name = "resourceId", paramType = "query", required = true, dataType = "String")})
    @RequiresPermissions("live:caster:all")
    @CasterTenant
    public RpcResponse deleteCasterVideoResource(String casterId, String resourceId) {
        return liveClient.liveCaster().deleteCasterVideoResource(casterId, resourceId);
    }
    
    @SysLog("修改视频资源")
    @PostMapping("/modifyCasterVideoLiveStreamResource")
    @ApiOperation("修改视频资源")
    @ApiImplicitParams({
            @ApiImplicitParam(value = "导播台Id。", name = "casterId", paramType = "query", required = true, dataType = "String"),
            @ApiImplicitParam(value = "视频源Id。", name = "resourceId", paramType = "query", required = true, dataType = "String"),
            @ApiImplicitParam(value = "视频源名称。", name = "resourceName", paramType = "query", required = true, dataType = "String"),
            @ApiImplicitParam(value = "直播流地址。", name = "liveStreamUrl", paramType = "query", required = true, dataType = "String")})
    @RequiresPermissions("live:caster:all")
    @CasterTenant
    public RpcResponse modifyCasterVideoLiveStreamResource(String casterId, String resourceId, String resourceName, String liveStreamUrl){
    	return liveClient.liveCaster().modifyCasterVideoLiveStreamResource(casterId, resourceId, resourceName, liveStreamUrl);
    }
    
    @GetMapping("/describeCasterVideoResources")
    @ApiOperation("查询视频源。")
    @ApiImplicitParams({@ApiImplicitParam(value = "导播台Id。", name = "casterId", paramType = "query", required = true, dataType = "String")})
    @RequiresPermissions("live:caster:all")
    public RpcResponse<List<CasterVideoResource>> describeCasterVideoResources(String casterId){
//    	return liveClient.liveCaster().describeCasterVideoResources(casterId);
    	return liveSceneLiveInfoExtService.describeCasterVideoResources(casterId);
    }
    
    @SysLog("添加导播台布局")
    @PostMapping("/addCasterLayout")
    @ApiOperation("添加导播台布局。")
    @ApiImplicitParams({
    		@ApiImplicitParam(value = "导播台Id。", name = "casterId", paramType = "query", required = true, dataType = "String"),
    		@ApiImplicitParam(value = "Videolayer配置列表，元素为视频画面的配置信息，如宽高、位置等，画面层次按列表顺序排列", name = "videoLayers", paramType = "query", required = true, dataType = "VideoLayer[]"),
    		@ApiImplicitParam(value = "Audiolayer配置列表，元素为音频配置信息，无层次关系", name = "audioLayers", paramType = "query", required = true, dataType = "AudioLayer[]"),
    		@ApiImplicitParam(value = "元素为资源的位置ID（locationId参见添加视频源），与VideoLayers元素顺序对应", name = "blendList", paramType = "query", required = true, dataType = "String[]"),
    		@ApiImplicitParam(value = "元素为资源的位置ID（locationId参见添加视频源），与VideoLayers元素顺序对应", name = "mixList", paramType = "query", required = true, dataType = "String[]")})
    @RequiresPermissions("live:caster:all")
    @CasterTenant
    public RpcResponse addCasterLayout(@RequestBody CasterLayoutVo casterLayout){

        return liveClient.liveCaster().addCasterLayout(casterLayout.getCasterId(), casterLayout.getVideoLayers(), casterLayout.getAudioLayers(), casterLayout.getBlendList(), casterLayout.getBlendList());
    }
    
    @SysLog("删除视频源")
    @PostMapping("/deleteCasterLayout")
    @ApiOperation("删除视频源")
    @ApiImplicitParams({
            @ApiImplicitParam(value = "导播台Id。", name = "casterId", paramType = "query", required = true, dataType = "String"),
            @ApiImplicitParam(value = "布局Id。", name = "layoutId", paramType = "query", required = true, dataType = "String")})
    @RequiresPermissions("live:caster:all")
    @CasterTenant
    public RpcResponse deleteCasterLayout(String casterId, String layoutId){
    	return liveClient.liveCaster().deleteCasterLayout(casterId, layoutId);
    }
    
    
    @GetMapping("/describeCasterLayouts")
    @ApiOperation("查询布局列表。")
    @ApiImplicitParams({
            @ApiImplicitParam(value = "导播台Id。", name = "casterId", paramType = "query", required = true, dataType = "String"),
            @ApiImplicitParam(value = "布局Id，若未指定，则查询导播台下所有布局列表", name = "layoutId", paramType = "query", dataType = "String")})
    @RequiresPermissions("live:caster:all")
    public RpcResponse<List<CasterLayout>> describeCasterLayouts(String casterId, String layoutId){
    	
    	return liveClient.liveCaster().describeCasterLayouts(casterId, layoutId);
    }
    
    @SysLog("修改布局配置，传递修改项，非修改内容无需传递")
    @PostMapping("/modifyCasterLayout")
    @ApiOperation("修改布局配置，传递修改项，非修改内容无需传递。")
    @ApiImplicitParams({
            @ApiImplicitParam(value = "导播台Id。", name = "casterId", paramType = "query", required = true, dataType = "String"),
            @ApiImplicitParam(value = "布局Id", name = "layoutId", paramType = "query", required = true, dataType = "String"),
            @ApiImplicitParam(value = "Videolayer配置列表，元素为视频画面的配置信息，如宽高、位置等，画面层次按列表顺序排列", name = "videoLayers", paramType = "query", required = true, dataType = "VideoLayer[]"),
            @ApiImplicitParam(value = "Audiolayer配置列表，元素为音频配置信息，无层次关系", name = "audioLayers", paramType = "query", required = true, dataType = "AudioLayer[]"),
            @ApiImplicitParam(value = "元素为资源的位置ID（locationId参见添加视频源），与VideoLayers元素顺序对应", name = "blendList", paramType = "query", required = true, dataType = "String[]"),
            @ApiImplicitParam(value = "元素为资源的位置ID（locationId参见添加视频源），与VideoLayers元素顺序对应", name = "mixList", paramType = "query", required = true, dataType = "String[]")})
    @RequiresPermissions("live:caster:all")
    @CasterTenant
    public RpcResponse modifyCasterLayout(@RequestBody CasterLayoutVo casterLayout){
    	return liveClient.liveCaster().modifyCasterLayout(casterLayout.getCasterId(), casterLayout.getLayoutId(), casterLayout.getVideoLayers(), casterLayout.getAudioLayers(), casterLayout.getBlendList(), casterLayout.getMixList());
    }
    
    @GetMapping("/describeCasterChannels")
    @ApiOperation("查询导播台通道信息列表。")
    @ApiImplicitParams({
            @ApiImplicitParam(value = "导播台Id。", name = "casterId", paramType = "query", required = true, dataType = "String")})
    @RequiresPermissions("live:caster:all")
    public RpcResponse describeCasterChannels(String casterId){
    	return liveClient.liveCaster().describeCasterChannels(casterId);
    }
    
    @SysLog("采用视频源同步模式时需要将视频资源设置到通道中")
    @PostMapping("/setCasterChannel")
    @ApiOperation("采用视频源同步模式时需要将视频资源设置到通道中。")
    @ApiImplicitParams({
            @ApiImplicitParam(value = "导播台Id。", name = "casterId", paramType = "query", required = true, dataType = "String"),
            @ApiImplicitParam(value = "通道Id。", name = "channelId", paramType = "query", required = true, dataType = "String"),
            @ApiImplicitParam(value = "视频源Id。", name = "resourceId", paramType = "query", required = true, dataType = "String"),
            @ApiImplicitParam(value = "仅对文件视频有效，直播源无效，必须大于0，表示从相对于首帧的偏差时间作为开始读取的位置。* 单位：毫秒(ms)", name = "seekOffset", paramType = "query", required = true, dataType = "Integer"),
            @ApiImplicitParam(value = "仅对文件视频有效，直播源无效。播放状态： 1：播放， 0：暂停。默认为：1：播放", name = "playStatus", paramType = "query", required = true, dataType = "Integer")})
    @RequiresPermissions("live:caster:all")
    @CasterTenant
    public RpcResponse setCasterChannel(String casterId, String channelId, String resourceId, Integer seekOffset, Integer playStatus){
    	return liveClient.liveCaster().setCasterChannel(casterId, channelId, resourceId, seekOffset, playStatus);
    }
    
    @SysLog("添加组件")
    @PostMapping("/addCasterComponent")
    @ApiOperation("添加组件。")
    @ApiImplicitParams({
            @ApiImplicitParam(value = "组件配置", name = "casterComponent", paramType = "query", required = true, dataType = "CasterComponentVo")})
    @RequiresPermissions("live:caster:all")
    @CasterTenant
    public RpcResponse<CasterComponent> addCasterComponent(@RequestBody CasterComponentVo casterComponent){
    	return liveClient
                .liveCaster()
                .addCasterComponent(
                        casterComponent.getCasterId(), casterComponent.getComponentName(), casterComponent.getLocationId(), casterComponent.getComponentType(), casterComponent.getEffect(),
                        casterComponent.getComponentLayer(), casterComponent.getTextLayerContent(), casterComponent.getImageLayerContent(), casterComponent.getCaptionLayerContent());
    }
    
    @SysLog("删除组件")
    @PostMapping("/deleteCasterComponent")
    @ApiOperation("删除组件")
    @ApiImplicitParams({
            @ApiImplicitParam(value = "导播台Id。", name = "casterId", paramType = "query", required = true, dataType = "String"),
            @ApiImplicitParam(value = "组件ID", name = "componentId", paramType = "query", required = true, dataType = "String")})
    @RequiresPermissions("live:caster:all")
    @CasterTenant
    public RpcResponse deleteCasterComponent(String casterId, String componentId){
    	return liveClient.liveCaster().deleteCasterComponent(casterId, componentId);
    }
    
    @SysLog("修改组件")
    @PostMapping("/modifyCasterComponent")
    @ApiOperation("修改组件")
    @ApiImplicitParams({
        @ApiImplicitParam(value = "组件配置", name = "casterComponent", paramType = "query", required = true, dataType = "CasterComponentVo")})
    @RequiresPermissions("live:caster:all")
    @CasterTenant
    public RpcResponse modifyCasterComponent(@RequestBody CasterComponentVo casterComponent){
    	return liveClient.liveCaster().modifyCasterComponent(
                casterComponent.getCasterId(), casterComponent.getComponentId(), casterComponent.getComponentName(), casterComponent.getComponentType(), casterComponent.getEffect(),
                casterComponent.getComponentLayer(), casterComponent.getTextLayerContent(), casterComponent.getImageLayerContent(), casterComponent.getCaptionLayerContent());
    }
    
    @GetMapping("/describeCasterComponents")
    @ApiOperation("查询组件")
    @ApiImplicitParams({
            @ApiImplicitParam(value = "导播台Id。", name = "casterId", paramType = "query", required = true, dataType = "String"),
            @ApiImplicitParam(value = "组件ID", name = "componentId", paramType = "query", required = true, dataType = "String")})
    @RequiresPermissions("live:caster:all")
    public RpcResponse<List<CasterComponent>> describeCasterComponents(String casterId, String componentId){
    	return liveClient.liveCaster().describeCasterComponents(casterId, componentId);
    }
    
    @GetMapping("/describeCasterStreamUrl")
    @ApiOperation("查询导播台流信息列表")
    @ApiImplicitParams({
            @ApiImplicitParam(value = "导播台Id。", name = "casterId", paramType = "query", required = true, dataType = "String")})
    @RequiresPermissions("live:caster:all")
    public RpcResponse<List<CasterStream>> describeCasterStreamUrl(String casterId){
    	return liveClient.liveCaster().describeCasterStreamUrl(casterId);
    }
    
    @SysLog("将指定场景画面紧急切换至备播视频，限制仅用于PGM场景的备播切换")
    @PostMapping("/effectCasterUrgent")
    @ApiOperation("将指定场景画面紧急切换至备播视频，限制仅用于PGM场景的备播切换")
    @ApiImplicitParams({
            @ApiImplicitParam(value = "导播台Id。", name = "casterId", paramType = "query", required = true, dataType = "String"),
            @ApiImplicitParam(value = "场景ID", name = "sceneId", paramType = "query", required = true, dataType = "String")})
    @RequiresPermissions("live:caster:all")
    @CasterTenant
    public RpcResponse effectCasterUrgent(String casterId, String sceneId){
    	return liveClient.liveCaster().effectCasterUrgent(casterId, sceneId);
    }
    
    @SysLog("采用视频源同步模式时需要将视频资源设置到通道中")
    @PostMapping("/effectCasterVideoResource")
    @ApiOperation("采用视频源同步模式时需要将视频资源设置到通道中。")
    @ApiImplicitParams({
            @ApiImplicitParam(value = "导播台Id。", name = "casterId", paramType = "query", required = true, dataType = "String"),
            @ApiImplicitParam(value = "通道Id。", name = "channelId", paramType = "query", required = true, dataType = "String"),
            @ApiImplicitParam(value = "视频源Id。", name = "resourceId", paramType = "query", required = true, dataType = "String")})
    @RequiresPermissions("live:caster:all")
    @CasterTenant
    public RpcResponse effectCasterVideoResource(String casterId, String channelId, String resourceId){
    	return liveClient.liveCaster().effectCasterVideoResource(casterId, channelId, resourceId);
    }
}