import { Controller, Get, Post, Body, Patch, Param, Delete } from '@nestjs/common';
import { PerformanceService } from './performance.service';
import { CreatePerformanceDto } from './dto/create-performance.dto';
import { UpdatePerformanceDto } from './dto/update-performance.dto';

@Controller('performance')
export class PerformanceController {
  constructor(private readonly performanceService: PerformanceService) {}

  @Post('calculate/:userId')
  calculateScore(@Param('userId') userId: string) {
    return this.performanceService.calculateUserScore(userId);
  }

  @Get('latest/:userId')
  getLatestScore(@Param('userId') userId: string) {
    return this.performanceService.getLatestScore(userId);
  }

  @Get('trend/:userId')
  getTrend(@Param('userId') userId: string) {
    return this.performanceService.getPerformanceTrend(userId);
  }

  @Get('funnel/:userId')
  getFunnel(@Param('userId') userId: string) {
    return this.performanceService.getFunnelData(userId);
  }

  @Get('quarterly/:userId')
  getQuarterly(@Param('userId') userId: string) {
    return this.performanceService.getQuarterlyStatus(userId);
  }

  @Get('team')
  getTeam() {
    return this.performanceService.getTeamPerformance();
  }

  @Get('funnel-config')
  getFunnelConfig() {
    return this.performanceService.getFunnelConfig();
  }

  @Patch('funnel-config')
  setFunnelConfig(@Body() body: any) {
    return this.performanceService.setFunnelConfig(body);
  }

  @Get('team-funnel')
  getTeamFunnel() {
    return this.performanceService.getTeamFunnel();
  }
}
