package com.red.circle.other.app.command.game.ludo;

import com.red.circle.common.business.dto.cmd.app.AppRoomIdCmd;
import com.red.circle.other.infra.database.mongo.service.game.GameLudoRunService;
import java.util.Objects;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;

/**
 * 房间是否存在游戏.
 *
 * @author pengliang on 2022/4/1
 */
@RequiredArgsConstructor
@Component
public class GameRoomExistsQueryExe {

  private final GameLudoRunService gameLudoRunService;

  public Boolean execute(AppRoomIdCmd cmd) {
    return Objects.equals(gameLudoRunService.exists(cmd.getRoomId()), Boolean.TRUE);
  }
}
