import { Controller, Get, Logger, Param, Post } from '@nestjs/common';
import { GameService } from './game.service';
import {VersusService} from "./versus/versus.service";

@Controller('game')
export class GameController {
  private readonly logger = new Logger(GameController.name);
  constructor(private gameService: GameService, private versusService: VersusService) {
  }

  @Post(':id/complete')
  async markQueueAsCompleted(@Param('id') id: string) {
    return this.gameService.markQueueAsCompleted(id);
  }

  @Post('pause')
  async pauseGame() {
    return this.gameService.pauseGame();
  }

  @Post('resume')
  async resumeGame() {
    return this.gameService.resumeGame();
  }

  @Get('state')
  async getState() {
    return this.gameService.getState();
  }

  @Get('playextracards')
  async playExtraCards() {
    return this.gameService.playExtraCards();
  }



  @Get('state-details')
  async getStateDetails() {
    return this.gameService.getStateDetails();
  }

  @Post('clear-queue')
  async clearQueue() {
    this.logger.warn(`[clearQueue] enter`);
    await this.gameService.clearGameQueue();
  }

  @Post('simulate-valid-answer')
  async simulateValidAnswer() {
    this.logger.verbose(`[simulateValidAnswer] enter`);
    return await this.gameService.simulateValidAnswer();
  }
}
