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

export class PlantingOrderResponse {
  @ApiProperty({ description: '订单号' })
  orderNo: string;

  @ApiProperty({ description: '认种数量' })
  treeCount: number;

  @ApiProperty({ description: '订单总金额' })
  totalAmount: number;

  @ApiProperty({ description: '订单状态' })
  status: string;

  @ApiPropertyOptional({ description: '省份代码' })
  provinceCode?: string | null;

  @ApiPropertyOptional({ description: '城市代码' })
  cityCode?: string | null;

  @ApiProperty({ description: '是否已开启挖矿' })
  isMiningEnabled: boolean;

  @ApiProperty({ description: '创建时间' })
  createdAt: Date;
}

export class CreateOrderResponse {
  @ApiProperty({ description: '订单号' })
  orderNo: string;

  @ApiProperty({ description: '认种数量' })
  treeCount: number;

  @ApiProperty({ description: '订单总金额' })
  totalAmount: number;

  @ApiProperty({ description: '订单状态' })
  status: string;
}

export class SelectProvinceCityResponse {
  @ApiProperty({ description: '是否成功' })
  success: boolean;

  @ApiProperty({ description: '选择时间' })
  selectedAt: Date;
}

export class ConfirmProvinceCityResponse {
  @ApiProperty({ description: '是否成功' })
  success: boolean;
}

export class PayOrderResponse {
  @ApiProperty({ description: '订单号' })
  orderNo: string;

  @ApiProperty({ description: '订单状态' })
  status: string;

  @ApiProperty({
    description: '资金分配详情',
    type: 'array',
    items: {
      type: 'object',
      properties: {
        targetType: { type: 'string' },
        amount: { type: 'number' },
        targetAccountId: { type: 'string', nullable: true },
      },
    },
  })
  allocations: Array<{
    targetType: string;
    amount: number;
    targetAccountId: string | null;
  }>;
}
