import { Controller, Get, Param, ParseIntPipe } from '@nestjs/common';
import { PublicTeamAccessService } from './public-team-access.service';

@Controller({ path: 'public/teams', version: '1' })
export class PublicTeamsController {
  constructor(private readonly publicAccess: PublicTeamAccessService) {}

  @Get(':token')
  getTeam(@Param('token') token: string) {
    return this.publicAccess.getPublicTeam(token);
  }

  @Get(':token/players/:playerId/transactions')
  getPlayerHistory(
    @Param('token') token: string,
    @Param('playerId', ParseIntPipe) playerId: number,
  ) {
    return this.publicAccess.getPublicPlayerHistory(token, playerId);
  }
}
