package com.platform.modules.live.service;

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

import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.IService;
import com.platform.common.utils.R;
import com.platform.common.utils.PageUtils;
import com.platform.modules.foreign.entity.SceneForeignEntity;
import com.platform.modules.live.entity.LiveSceneEntity;
import com.platform.modules.live.entity.LiveSceneLiveInfoEntity;
import com.platform.modules.live.vo.AppSceneEntityVo;
import com.platform.modules.live.vo.LiveInfoVo;
import com.platform.modules.live.vo.SceneCommentCountVo;
import com.platform.modules.live.vo.SceneEntityVo;
import com.platform.modules.sys.entity.SysUserEntity;
import com.platform.plugs.common.rpc.RpcResponse;
import com.platform.plugs.live.responseEntity.CasterConfig;
import org.springframework.web.multipart.MultipartFile;


/**
 * 现场表
 * 
 * @author TROY
 * @email 
 * @date 2019-01-19 14:50:50
 */
public interface LiveSceneService extends IService<LiveSceneEntity> {

	Page page(String title, Integer sceneType, String ltype,Integer liveState, Integer pageNo, Integer pageSize, Long tenantId);

	PageUtils page(String title, Integer sceneType,Integer userId, String ltype, Integer pageNo, Integer pageSize);

	void save(SceneEntityVo liveScene);

	R save(AppSceneEntityVo liveScene, MultipartFile titleFile, MultipartFile videoFile);

	SceneEntityVo info(Integer id);

	String update(SceneEntityVo liveScene, SysUserEntity updator);

	R update(AppSceneEntityVo liveScene, LiveSceneEntity entity, MultipartFile titleFile, MultipartFile videoFile);

	void check(Integer id, Integer pass, SysUserEntity user);

//	void direct(Integer id, boolean start);

	List<LiveInfoVo> streamList(Map<String, Object> params);

	void delete(Integer id);

	void deleteBatch(Integer[] ids);

	R createStream(LiveSceneLiveInfoEntity liveSceneLiveInfoEntity);

	R updateStream(LiveSceneLiveInfoEntity liveSceneLiveInfoEntity);

	R streamPullStart(Integer id);

	R streamPullEnd(Integer id);

	R streamInfo(Integer id);

	R deleteStream(Integer[] infoIds);

	R reporterList(Integer scendId);

	SceneForeignEntity getForeignScnenInfo(Integer id);

	R broadcast(Integer id, boolean start);

	R streamPlay(Integer sceneId);

	R indexRebuild(Integer begin);

	void streamShow(Integer sceneId, Integer[] infoIds, Integer isShow);

	void submit(Integer id);

	List<SceneEntityVo> recentScene(Map<String, Object> params);

	List<SceneEntityVo> recentLiveReport(Map<String, Object> params);
	
	void topBatch(Integer[] ids,Long userId);
	
	void cancelTopBatch(Integer[] ids,Long userId);
	
	void priority(Integer[] ids,Integer[] prioritys,Long userId);

	R distribute(Integer id);

	R getLiveStreamsOnlineList(Integer id);

	RpcResponse startCasterScene(Integer id);

	RpcResponse stopCasterScene(Integer id);

	RpcResponse setCasterConfig(Integer sceneId, CasterConfig casterConfig);

	RpcResponse startCaster(Integer id);

	R stopCaster(Integer id, Boolean close);

	R copyCasterSceneConfig(Integer id, String casterId, String fromSceneId, String toSceneId);

    /**
     * 系统app用户查询有需要审核评论的现场page
     *
     * @param page
     *            页码
     * @param limit
     *            每页大小
     * @return 页面信息
     */
    Page<SceneCommentCountVo> querySceneCommentPage(Integer page, Integer limit);

    LiveSceneEntity selectBySign(String appName);

	R getCasterStreamsUrl(Integer id);
	
	void recycle(Integer[] ids);
	
	void cycleDelete(Integer[] ids);

	/**
	 * 20200319_Mxy 拖动排序
	 *
	 * @param cid 栏目id
	 * @param sceneIds 拖动的现场id
	 * @param dragSorts 排序标识
	 * */
	R dragSort(Integer cid, Integer[] sceneIds, long[] dragSorts);
	/**
	 * 拖动排序分页
	 * */
	PageUtils sortScenePage(Integer cid, Integer pageSize, Integer pageNo, String title, Integer sceneType, Integer liveState, Integer deleteFlag, Long tenantId);
	/**
	 * 拖动排序操作锁定与解锁
	 * */
	void lockSort(boolean flag, Integer cid);
	/**
	 * 拖动排序锁定判断
	 * */
	boolean isLockSort(Integer cid);
	/**
	 * 成品现场【全部】
	 */
	Page<SceneEntityVo> pageProd(String title, Integer sceneType, String ltype,Integer liveState, Integer pageNo, Integer pageSize, Long tenantId);
	/**
	 * 根据自动开播设置刷新现场状态
	 * */
	List<LiveSceneEntity> freshLiveStateByAutoLive();

	void createSceneIndex(LiveSceneEntity scene, Date createDate, Integer sceneState, Integer liveState,
						  String thumb, Boolean create) ;

	/**
	 * 现场重置为预告状态
	 *
	 * @param id 直播id
	 * @return 是否重置成功
	 */
	R resetLiveState(LiveSceneEntity entity);
}
