import { Controller, Get, Query, UseGuards } from '@nestjs/common';
import { ApiBearerAuth, ApiTags } from '@nestjs/swagger';
import { CurrentUser } from '../../common/decorators/current-user.decorator';
import { JwtAuthGuard } from '../../common/guards/jwt-auth.guard';
import { JwtPayload } from '../../common/interfaces/jwt-payload.interface';
import { FeedQueryDto } from './dto/feed-query.dto';
import { FeedService } from './feed.service';

@ApiTags('Feed')
@Controller('feed')
export class FeedController {
  constructor(private readonly feedService: FeedService) {}

  @ApiBearerAuth()
  @UseGuards(JwtAuthGuard)
  @Get('me')
  async myFeed(@CurrentUser() user: JwtPayload, @Query() query: FeedQueryDto) {
    return this.feedService.getMyFeed(user.sub, query);
  }

  @ApiBearerAuth()
  @UseGuards(JwtAuthGuard)
  @Get('reels')
  async reels(@CurrentUser() user: JwtPayload, @Query() query: FeedQueryDto) {
    return this.feedService.getReels(user.sub, query);
  }

  @ApiBearerAuth()
  @UseGuards(JwtAuthGuard)
  @Get('trending')
  async trending(@CurrentUser() user: JwtPayload, @Query() query: FeedQueryDto) {
    return this.feedService.getTrending(user.sub, query);
  }

  @ApiBearerAuth()
  @UseGuards(JwtAuthGuard)
  @Get('explore')
  async explore(@CurrentUser() user: JwtPayload, @Query() query: FeedQueryDto) {
    return this.feedService.getExplore(user.sub, query);
  }
}
