import { Controller, Get, Param, Query } from '@nestjs/common';
import { DashboardService } from './dashboard.service';
import { DashboardFilterDto } from './dto/dashboard-filter.dto';

@Controller('dashboard')
export class DashboardController {
  constructor(private readonly dashboardService: DashboardService) {}

  /**
   * GET /dashboard/summary/:farmNo - 농장 현황 요약
   */
  @Get('summary/:farmNo')
  getFarmSummary(
    @Param('farmNo') farmNo: string,
    @Query() filter: DashboardFilterDto,
  ) {
    return this.dashboardService.getFarmSummary(+farmNo, filter);
  }

  /**
   * GET /dashboard/analysis-completion/:farmNo - 분석 완료 현황
   */
  @Get('analysis-completion/:farmNo')
  getAnalysisCompletion(
    @Param('farmNo') farmNo: string,
    @Query() filter: DashboardFilterDto,
  ) {
    return this.dashboardService.getAnalysisCompletion(+farmNo, filter);
  }

  /**
   * GET /dashboard/evaluation/:farmNo - 농장 종합 평가
   */
  @Get('evaluation/:farmNo')
  getFarmEvaluation(
    @Param('farmNo') farmNo: string,
    @Query() filter: DashboardFilterDto,
  ) {
    return this.dashboardService.getFarmEvaluation(+farmNo, filter);
  }

  /**
   * GET /dashboard/region-comparison/:farmNo - 보은군 비교 분석
   */
  @Get('region-comparison/:farmNo')
  getRegionComparison(
    @Param('farmNo') farmNo: string,
    @Query() filter: DashboardFilterDto,
  ) {
    return this.dashboardService.getRegionComparison(+farmNo, filter);
  }

  /**
   * GET /dashboard/cow-distribution/:farmNo - 개체 분포 분석
   */
  @Get('cow-distribution/:farmNo')
  getCowDistribution(
    @Param('farmNo') farmNo: string,
    @Query() filter: DashboardFilterDto,
  ) {
    return this.dashboardService.getCowDistribution(+farmNo, filter);
  }

  /**
   * GET /dashboard/kpn-aggregation/:farmNo - KPN 추천 집계
   */
  @Get('kpn-aggregation/:farmNo')
  getKpnRecommendationAggregation(
    @Param('farmNo') farmNo: string,
    @Query() filter: DashboardFilterDto,
  ) {
    return this.dashboardService.getKpnRecommendationAggregation(+farmNo, filter);
  }

  /**
   * GET /dashboard/farm-kpn-inventory/:farmNo - 농장 보유 KPN 목록
   */
  @Get('farm-kpn-inventory/:farmNo')
  getFarmKpnInventory(@Param('farmNo') farmNo: string) {
    return this.dashboardService.getFarmKpnInventory(+farmNo);
  }

  /**
   * GET /dashboard/analysis-years/:farmNo - 농장 분석 이력 연도 목록
   */
  @Get('analysis-years/:farmNo')
  getAnalysisYears(@Param('farmNo') farmNo: string) {
    return this.dashboardService.getAnalysisYears(+farmNo);
  }

  /**
   * GET /dashboard/analysis-years/:farmNo/latest - 최신 분석 연도
   */
  @Get('analysis-years/:farmNo/latest')
  getLatestAnalysisYear(@Param('farmNo') farmNo: string) {
    return this.dashboardService.getLatestAnalysisYear(+farmNo);
  }

  /**
   * GET /dashboard/year-comparison/:farmNo - 3개년 비교 분석
   */
  @Get('year-comparison/:farmNo')
  getYearComparison(@Param('farmNo') farmNo: string) {
    return this.dashboardService.getYearComparison(+farmNo);
  }

  /**
   * GET /dashboard/repro-efficiency/:farmNo - 번식 효율성 분석
   */
  @Get('repro-efficiency/:farmNo')
  getReproEfficiency(
    @Param('farmNo') farmNo: string,
    @Query() filter: DashboardFilterDto,
  ) {
    return this.dashboardService.getReproEfficiency(+farmNo, filter);
  }

  /**
   * GET /dashboard/excellent-cows/:farmNo - 우수개체 추천
   */
  @Get('excellent-cows/:farmNo')
  getExcellentCows(
    @Param('farmNo') farmNo: string,
    @Query() filter: DashboardFilterDto,
  ) {
    return this.dashboardService.getExcellentCows(+farmNo, filter);
  }

  /**
   * GET /dashboard/cull-cows/:farmNo - 도태개체 추천
   */
  @Get('cull-cows/:farmNo')
  getCullCows(
    @Param('farmNo') farmNo: string,
    @Query() filter: DashboardFilterDto,
  ) {
    return this.dashboardService.getCullCows(+farmNo, filter);
  }

  /**
   * GET /dashboard/cattle-ranking/:farmNo - 보은군 내 소 개별 순위
   */
  @Get('cattle-ranking/:farmNo')
  getCattleRankingInRegion(
    @Param('farmNo') farmNo: string,
    @Query() filter: DashboardFilterDto,
  ) {
    return this.dashboardService.getCattleRankingInRegion(+farmNo, filter);
  }
}
