package com.red.circle.other.app.service.room;

import com.red.circle.common.business.dto.cmd.AppExtCommand;
import com.red.circle.common.business.dto.cmd.app.AppRoomIdCmd;
import com.red.circle.other.app.command.room.*;
import com.red.circle.other.app.command.room.query.RoomLockAndUnLockCheckQryExe;
import com.red.circle.other.app.command.room.query.RoomSettingByUserQryExe;
import com.red.circle.other.app.command.room.query.RoomSettingQryExe;
import com.red.circle.other.app.dto.clientobject.family.RoomSettingCO;
import com.red.circle.other.app.dto.clientobject.room.RoomSudCo;
import com.red.circle.other.app.dto.cmd.room.KickOffMicrophoneCmd;
import com.red.circle.other.app.dto.cmd.room.LockedRoomCmd;
import com.red.circle.other.app.dto.cmd.room.UpdateRoomSettingCmd;
import com.red.circle.other.app.dto.cmd.room.UpdateRoomSudCmd;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

/**
 * @author pengliang on 2021/3/30
 */
@Service
@RequiredArgsConstructor
public class RoomSettingServiceImpl implements RoomSettingService {

  private final LockedRoomCmdExe lockedRoomCmdExe;
  private final RoomSettingQryExe roomSettingQryExe;
  private final RoomSudUserCmdExe roomSudUserCmdExe;
  private final UnlockedRoomCmdExe unlockedRoomCmdExe;
  private final UpdateRoomSettingCmdExe updateRoomSettingCmdExe;
  private final KickOffMicrophoneCmdExe kickOffMicrophoneCmdExe;
  private final RoomSettingByUserQryExe roomSettingByUserQryExe;
  private final RoomLockAndUnLockCheckQryExe roomLockAndUnLockCheckQryExe;

  @Override
  public RoomSettingCO roomSettingInfo(AppRoomIdCmd cmd) {
    return roomSettingQryExe.execute(cmd);
  }

  @Override
  public void updateSetting(UpdateRoomSettingCmd cmd) {
    updateRoomSettingCmdExe.execute(cmd);
  }

  @Override
  public boolean checkLockAndUnlock(AppRoomIdCmd cmd) {
    return roomLockAndUnLockCheckQryExe.execute(cmd);
  }

  @Override
  public boolean kickOffMicrophone(KickOffMicrophoneCmd cmd) {
    return kickOffMicrophoneCmdExe.execute(cmd);
  }

  @Override
  public RoomSettingCO meRoomSettingInfo(AppExtCommand cmd) {
    return roomSettingByUserQryExe.execute(cmd);
  }

  @Override
  public void unlockedRoom(AppRoomIdCmd cmd) {
    unlockedRoomCmdExe.execute(cmd);
  }

  @Override
  public void lockedRoom(LockedRoomCmd cmd) {
    lockedRoomCmdExe.execute(cmd);
  }

  @Override
  public RoomSudCo getRoomSud(AppRoomIdCmd cmd) {
    return roomSudUserCmdExe.execute(cmd);
  }

  @Override
  public void updateRoomSud(UpdateRoomSudCmd cmd) {
    roomSudUserCmdExe.addRoomSud(cmd);
  }

}
