package com.red.circle.live.domain.gateway;

import com.red.circle.live.domain.live.LiveMicUser;
import com.red.circle.live.domain.live.LiveMicrophone;
import com.red.circle.live.domain.live.dto.LiveMicrophoneDTO;
import com.red.circle.live.domain.live.dto.LiveMicrophoneNoticeDTO;
import com.red.circle.live.domain.online.LiveRoomUser;
import com.red.circle.other.inner.model.dto.live.RoomProfileDTO;
import com.red.circle.tool.core.func.VoidConsumer;
import java.util.List;
import java.util.Map;
import java.util.Set;

/**
 * @author pengliang on 2023/12/11
 */
public interface LiveMicrophoneGateway {

  /**
   * 获取麦克风位置数据.
   */
  LiveMicrophone getLiveMicrophone(Long roomId, Integer micIndex, Long userId);

  /**
   * 麦克风用户.
   */
  LiveMicUser getLiveMicUser(Long roomId, Long userId);

  /**
   * 获取一片房间用户资料.
   */
  Map<Long, LiveMicUser> mapLiveMicUser(Long roomId, Set<Long> userIds);

  /**
   * 初始化麦克风.
   */
  void initMicSetting(Long roomId, Integer micSize);

  /**
   * 麦克风变更通知.
   */
  List<LiveMicrophoneDTO> listLiveMicrophone(Long roomId);

  /**
   * 上麦克风.
   */

  LiveMicrophoneNoticeDTO goUp(Long roomId, Integer micIndex, Long userId);

  /**
   * 下麦克风.
   */
  void goDown(Long roomId, Integer micIndex, Long userId);

  /**
   * 下掉指定麦克风.
   */
  void killMic(Long roomId, Integer micIndex, Long opsUserId);

  /**
   * 操作麦克风, 上锁.
   */
  void micOpsLock(Long roomId, Integer index);

  /**
   * 操作麦克风, 解锁.
   */
  void micOpsUnlock(Long roomId, Integer index);

  /**
   * 上锁/解锁麦克风.
   */
  void micLock(Long roomId, Integer mickIndex, Boolean lock, Long opsUserId);

  /**
   * 静音/解处静音 麦克风.
   */
  void micMute(Long roomId, Integer mickIndex, Boolean mute, Long opsUserId);

  /**
   * 修改麦克风数量.
   */
  void updateMickSize(Long roomId, Integer micSize);

  /**
   * 麦克风变更通知.
   */
  LiveMicrophoneNoticeDTO micUserChangeNotice(Long roomId);

  /**
   * 操作麦克风, 上/解锁: 获取锁成功则执行具体逻辑块否则不执行.
   */
  void tryMicOpsLock(Long roomId, Integer index, VoidConsumer voidConsumer);

  /**
   * 移除房间在线用户.
   */
  void removeRoomOnlineUser(Long roomId, Long userId);

  /**
   * 添加房间在线用户.
   */
  void addRoomOnlineUser(Long roomId, LiveRoomUser liveRoomUser);

  /**
   * 刷新麦克风上用户角色.
   */
  void refreshMicUserRoles(Long roomId, Long userId);

  /**
   * 刷掉不活跃麦克风用户.
   */
  void refreshNotActiveUser(RoomProfileDTO roomProfile);
}
