import { Controller, Get, UseGuards } from "@nestjs/common";
import { AuthGuard } from "../auth/guards/auth.guard";
import { WorkspaceGuard, PermissionGuard } from "../common/guards";
import { Workspace, RequirePermission, Permission } from "../common/decorators";
import { StatsService } from "./services";

/**
 * Controller for knowledge statistics endpoints
 */
@Controller("knowledge/stats")
@UseGuards(AuthGuard, WorkspaceGuard, PermissionGuard)
export class KnowledgeStatsController {
  constructor(private readonly statsService: StatsService) {}

  /**
   * GET /api/knowledge/stats
   * Get knowledge base statistics
   * Requires: Any workspace member
   */
  @Get()
  @RequirePermission(Permission.WORKSPACE_ANY)
  async getStats(@Workspace() workspaceId: string) {
    return this.statsService.getStats(workspaceId);
  }
}
