package com.dji.sample.manage.service;

import com.dji.sample.manage.model.dto.CapacityDeviceDTO;
import com.dji.sample.manage.model.dto.LiveTypeDTO;
import com.dji.sdk.cloudapi.device.VideoId;
import com.dji.sdk.common.HttpResultResponse;

import java.util.List;

/**
 * @author sean.zhou
 * @date 2021/11/19
 * @version 0.1
 */
public interface ILiveStreamService {

    /**
     * Get the drone data that can be broadcast live in this workspace.
     * @param workspaceId
     * @param deviceSn 设备sn
     * @return
     */
    CapacityDeviceDTO getLiveCapacity(String workspaceId, String deviceSn);

    /**
     * Get the drone data that can be broadcast live in this workspace.
     * @param deviceSn 设备sn
     * @return
     */
    CapacityDeviceDTO getLiveCapacity2(String deviceSn);

    /**
     * Get all the drone data that can be broadcast live in this workspace.
     * @param workspaceId
     * @return
     */
    List<CapacityDeviceDTO> getLiveCapacity(String workspaceId);

    /**
     * Initiate a live streaming by publishing mqtt message.
     * @param liveParam Parameters needed for on-demand.
     * @return
     */
    HttpResultResponse liveStart(LiveTypeDTO liveParam);

    /**
     * Stop the live streaming by publishing mqtt message.
     * @param videoId
     * @return
     */
    HttpResultResponse liveStop(VideoId videoId);

    /**
     * Readjust the clarity of the live streaming by publishing mqtt messages.
     * @param liveParam
     * @return
     */
    HttpResultResponse liveSetQuality(LiveTypeDTO liveParam);

    /**
     * Switches the lens of the device during the live streaming.
     * @param liveParam
     * @return
     */
    HttpResultResponse liveLensChange(LiveTypeDTO liveParam);

    /**
     * 直播相机切换
     * @param liveParam
     * @return
     */
    HttpResultResponse liveCameraChange(LiveTypeDTO liveParam);

    /**
     * 会话感知的停流：仅注销指定 sessionId 的观看会话，当观看者计数归零时才真正向设备发送停流指令。
     * @param videoId   直播流标识
     * @param sessionId 观看会话ID（服务端在 liveStart 时生成的 UUID）
     * @return 操作结果
     */
    HttpResultResponse liveStopSession(VideoId videoId, String sessionId);

    /**
     * 心跳续约：刷新指定 sessionId 的观看者会话 Redis key 的 TTL。
     * @param videoId   直播流标识
     * @param sessionId 观看会话ID
     * @return 操作结果
     */
    HttpResultResponse liveHeartbeat(VideoId videoId, String sessionId);

    /**
     * 强制停流：清除所有观看者会话并立即执行真正停流（供 stop2 等无鉴权接口使用）。
     * @param videoId 直播流标识
     * @return 操作结果
     */
    HttpResultResponse liveForceStop(VideoId videoId);

}
