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

import com.red.circle.common.business.dto.cmd.app.AppRoomIdCmd;
import com.red.circle.other.app.convertor.game.GameLudoAppConvertor;
import com.red.circle.other.app.dto.clientobject.game.GameLudoRunCO;
import com.red.circle.other.infra.database.mongo.service.game.GameLudoRunService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;

/**
 * 获取房间运行ludo游戏.
 *
 * @author pengliang on 2021/7/27
 */
@Component
@RequiredArgsConstructor
public class GameLudoRoomRunQueryExe {

  private final GameLudoAppConvertor gameLudoAppConvertor;
  private final GameLudoRunService gameLudoRunService;

  public GameLudoRunCO execute(AppRoomIdCmd cmd) {
    return gameLudoAppConvertor.entityToGameLudoRunCO(gameLudoRunService.get(cmd.getRoomId()));
  }

}
