package com.red.circle.live.app.service;

import com.red.circle.common.business.dto.cmd.app.AppRoomIdCmd;
import com.red.circle.live.app.command.user.HeartbeatUploadCmdExe;
import com.red.circle.live.app.command.user.LiveMusicHeartbeatCmdExe;
import com.red.circle.live.app.command.user.LiveMusicRemoveCmdExe;
import com.red.circle.live.app.command.user.LiveQuitRoomExe;
import com.red.circle.live.app.command.user.qry.LiveMusicQryExe;
import com.red.circle.live.app.command.user.qry.LiveOnlineUserQryExe;
import com.red.circle.live.app.command.user.qry.LiveSpeakUserQryExe;
import com.red.circle.live.app.dto.clientobject.LiveMicUserCO;
import com.red.circle.live.app.dto.cmd.HeartbeatUploadCmd;
import com.red.circle.live.app.dto.cmd.LiveMusicStatusCmd;
import com.red.circle.other.inner.model.dto.user.UserProfileDTO;
import java.util.List;
import java.util.Map;

import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

/**
 * 直播房间用户.
 *
 * @author pengliang on 2023/12/8
 */
@Service
@RequiredArgsConstructor
public class LiveRoomUserServiceImpl implements LiveRoomUserService {

  private final LiveQuitRoomExe liveQuitRoomExe;
  private final LiveMusicQryExe liveMusicQryExe;
  private final LiveOnlineUserQryExe liveOnlineUserQryExe;
  private final LiveSpeakUserQryExe liveSpeakUserQryExe;
  private final HeartbeatUploadCmdExe heartbeatUploadCmdExe;
  private final LiveMusicRemoveCmdExe liveMusicRemoveCmdExe;
  private final LiveMusicHeartbeatCmdExe liveMusicHeartbeatCmdExe;

  @Override
  public List<LiveMicUserCO> listSpeakUser(AppRoomIdCmd cmd) {
    return liveSpeakUserQryExe.execute(cmd);
  }

  @Override
  public List<LiveMicUserCO> listUser(AppRoomIdCmd cmd) {
    return liveOnlineUserQryExe.execute(cmd);
  }

  @Override
  public void heartbeat(HeartbeatUploadCmd cmd) {
    heartbeatUploadCmdExe.execute(cmd);
  }

  @Override
  public void quitRoom(AppRoomIdCmd cmd) {
    liveQuitRoomExe.execute(cmd);
  }

  @Override
  public Map<String,Object> musicStatus(LiveMusicStatusCmd cmd) {
    return liveMusicHeartbeatCmdExe.execute(cmd);
  }

  @Override
  public void removeMusic(AppRoomIdCmd cmd) {
    liveMusicRemoveCmdExe.execute(cmd);
  }

  @Override
  public UserProfileDTO getMusicUserProfile(AppRoomIdCmd cmd) {
    return liveMusicQryExe.execute(cmd);
  }

  @Override
  public List<Long> channelHost(AppRoomIdCmd cmd) {
    return liveSpeakUserQryExe.channelHost(cmd);
  }


}
