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

export class OverviewBookingKpisDto {
  @ApiProperty() totalActive!: number;
  @ApiProperty() needsAction!: number;
  @ApiProperty() urgent!: number;
  @ApiProperty() inApproval!: number;
  @ApiProperty() submittedToday!: number;
}

export class OverviewOperationsKpisDto {
  @ApiProperty() trainsActive!: number;
  @ApiProperty() wagonsAvailable!: number;
  @ApiProperty() containersInTransit!: number;
  @ApiProperty() cargoesLoaded!: number;
}

export class OverviewCustomerKpisDto {
  @ApiProperty() totalCustomers!: number;
  @ApiProperty() newCustomersThisMonth!: number;
}

export class OverviewBillingKpisDto {
  @ApiProperty() revenueMtdEtb!: number;
  @ApiProperty() revenueMtdUsd!: number;
  @ApiProperty() pendingPayments!: number;
  @ApiProperty() successfulPaymentsMtd!: number;
}

export class OverviewStaffKpisDto {
  @ApiProperty() activeEmployees!: number;
  @ApiProperty() activeUsers!: number;
}

export class OverviewKpisDto {
  @ApiProperty({ type: OverviewBookingKpisDto })
  bookings!: OverviewBookingKpisDto;

  @ApiProperty({ type: OverviewOperationsKpisDto })
  operations!: OverviewOperationsKpisDto;

  @ApiProperty({ type: OverviewCustomerKpisDto })
  customers!: OverviewCustomerKpisDto;

  @ApiProperty({ type: OverviewBillingKpisDto })
  billing!: OverviewBillingKpisDto;

  @ApiProperty({ type: OverviewStaffKpisDto })
  staff!: OverviewStaffKpisDto;
}

export class OverviewTrendPointDto {
  @ApiProperty({ example: '2026-06-01' }) date!: string;
  @ApiProperty() count!: number;
}

export class OverviewStatusCountDto {
  @ApiProperty() status!: string;
  @ApiProperty() count!: number;
}

export class OverviewPipelineCountDto {
  @ApiProperty() stage!: string;
  @ApiProperty() count!: number;
}

export class OverviewPaymentTrendPointDto {
  @ApiProperty({ example: '2026-06-01' }) date!: string;
  @ApiProperty() amountEtb!: number;
  @ApiProperty() amountUsd!: number;
}

export class OverviewRecentBookingDto {
  @ApiProperty() id!: string;
  @ApiProperty() reference!: string;
  @ApiProperty() customerLabel!: string;
  @ApiProperty() status!: string;
  @ApiProperty() priorityScore!: number;
  @ApiProperty({ nullable: true }) totalAmount!: number | null;
  @ApiProperty({ nullable: true }) paymentCurrency!: string | null;
  @ApiProperty() createdAt!: string;
}

export class OverviewResponseDto {
  @ApiProperty({ type: OverviewKpisDto })
  kpis!: OverviewKpisDto;

  @ApiProperty({ type: [OverviewTrendPointDto] })
  bookingTrend!: OverviewTrendPointDto[];

  @ApiProperty({ type: [OverviewStatusCountDto] })
  bookingsByStatus!: OverviewStatusCountDto[];

  @ApiProperty({ type: [OverviewPipelineCountDto] })
  bookingsByPipeline!: OverviewPipelineCountDto[];

  @ApiProperty({ type: [OverviewPaymentTrendPointDto] })
  paymentTrend!: OverviewPaymentTrendPointDto[];

  @ApiProperty({ type: [OverviewRecentBookingDto] })
  recentBookings!: OverviewRecentBookingDto[];

  @ApiProperty() generatedAt!: string;
}
