import { ApiProperty } from '@nestjs/swagger';

/**
 * 状态分布 DTO
 */
export class StatusDistributionDto {
  @ApiProperty({ description: '已支付状态的认种数', example: 100 })
  paid: number;

  @ApiProperty({ description: '资金已分配状态的认种数', example: 80 })
  fundAllocated: number;

  @ApiProperty({ description: '底池已排期状态的认种数', example: 50 })
  poolScheduled: number;

  @ApiProperty({ description: '底池已注入状态的认种数', example: 30 })
  poolInjected: number;

  @ApiProperty({ description: '挖矿已开启状态的认种数（有效认种）', example: 500 })
  miningEnabled: number;
}

/**
 * 今日统计 DTO
 */
export class TodayStatsDto {
  @ApiProperty({ description: '今日认种棵数', example: 10 })
  treeCount: number;

  @ApiProperty({ description: '今日订单数', example: 5 })
  orderCount: number;

  @ApiProperty({ description: '今日认种金额', example: '1000.00' })
  amount: string;
}

/**
 * 本月统计 DTO
 * [2026-01-06] 新增
 */
export class MonthStatsDto {
  @ApiProperty({ description: '本月认种棵数', example: 150 })
  treeCount: number;

  @ApiProperty({ description: '本月订单数', example: 50 })
  orderCount: number;

  @ApiProperty({ description: '本月认种金额', example: '15000.00' })
  amount: string;
}

/**
 * 全局统计响应 DTO
 * [2026-01-06] 更新：添加本月统计
 */
export class GlobalStatsResponseDto {
  @ApiProperty({ description: '总认种棵数（PAID及之后状态）', example: 760 })
  totalTreeCount: number;

  @ApiProperty({ description: '总订单数', example: 150 })
  totalOrderCount: number;

  @ApiProperty({ description: '总认种金额', example: '76000.00' })
  totalAmount: string;

  @ApiProperty({ description: '按状态分布的认种数', type: StatusDistributionDto })
  statusDistribution: StatusDistributionDto;

  @ApiProperty({ description: '今日统计', type: TodayStatsDto })
  todayStats: TodayStatsDto;

  @ApiProperty({ description: '本月统计', type: MonthStatsDto })
  monthStats: MonthStatsDto;

  @ApiProperty({ description: '统计计算时间', example: '2026-01-04T12:00:00.000Z' })
  calculatedAt: string;
}

/**
 * 趋势数据响应 DTO
 * [2026-01-06] 新增
 */
export class TrendDataResponseDto {
  @ApiProperty({ description: '时间标签', example: '2026-01-06' })
  label: string;

  @ApiProperty({ description: '认种棵数', example: 10 })
  treeCount: number;

  @ApiProperty({ description: '订单数', example: 5 })
  orderCount: number;

  @ApiProperty({ description: '认种金额', example: '1000.00' })
  amount: string;
}
