import {
  Controller,
  Get,
  Param,
  ParseUUIDPipe,
  UseGuards,
} from '@nestjs/common';
import { ApiOperation, ApiResponse, ApiTags } from '@nestjs/swagger';
import { JwtAuthGuard } from '../auth/guards/jwt-auth.guard';
import { ActivityService, type ActivityResponse } from './activity.service';

// 활동 피드 컨트롤러 — 읽기 전용. 조직 모델상 인증 사용자면 열람 가능
@ApiTags('Activity')
@Controller('projects/:projectId/activity')
@UseGuards(JwtAuthGuard)
export class ActivityController {
  constructor(private readonly activityService: ActivityService) {}

  @Get()
  @ApiOperation({ summary: '프로젝트 활동 피드 (최신순)' })
  @ApiResponse({ status: 200, description: '조회 성공' })
  list(
    @Param('projectId', ParseUUIDPipe) projectId: string,
  ): Promise<ActivityResponse[]> {
    return this.activityService.listForProject(projectId);
  }
}
