import { ApiProperty } from "@nestjs/swagger";
import { PaymentRefundStatus } from "@prisma/client";

export class RefundDto {
  @ApiProperty({ example: "re_01HXYZABCDEFGHJKMNPQRSTV" })
  id!: string;

  @ApiProperty({ example: "pa_01HXYZABCDEFGHJKMNPQRSTV" })
  attemptId!: string;

  @ApiProperty({ example: "50000.0000", description: "Decimal(20,4) serializado como string." })
  amount!: string;

  @ApiProperty({ required: false, nullable: true, example: "Cliente canceló la orden" })
  reason!: string | null;

  @ApiProperty({ enum: PaymentRefundStatus, example: PaymentRefundStatus.approved })
  status!: PaymentRefundStatus;

  @ApiProperty({ required: false, nullable: true, example: "R-99887766" })
  providerRefundId!: string | null;

  @ApiProperty({ example: "2026-06-07T14:30:00.000Z" })
  createdAt!: Date;
}

export class RefundListDto {
  @ApiProperty({ type: [RefundDto] })
  data!: RefundDto[];

  @ApiProperty({ required: false, nullable: true, example: null })
  nextCursor!: string | null;
}
