import { ApiProperty } from "@nestjs/swagger";
import { FxStrategy, Provider, ProviderMode } from "@prisma/client";

export class ProviderConfigDto {
  @ApiProperty({ example: "pcfg_01HXYZABCDEFGHJKMNPQRSTV" })
  id!: string;

  @ApiProperty({ example: "mer_01HXYZABCDEFGHJKMNPQRSTV" })
  merchantId!: string;

  @ApiProperty({ enum: Provider, example: Provider.dlocal })
  provider!: Provider;

  @ApiProperty({ enum: ProviderMode, example: ProviderMode.sandbox })
  mode!: ProviderMode;

  @ApiProperty({ example: "PY" })
  country!: string;

  @ApiProperty({ enum: FxStrategy, example: FxStrategy.delegate_provider })
  fxStrategy!: FxStrategy;

  @ApiProperty({ example: 0 })
  priority!: number;

  @ApiProperty({ example: true })
  active!: boolean;

  @ApiProperty({
    example: true,
    description: "Indica si hay credenciales almacenadas. El valor de las credenciales **nunca** se devuelve por API.",
  })
  hasCredentials!: boolean;

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

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

export class ProviderConfigListDto {
  @ApiProperty({ type: [ProviderConfigDto] })
  data!: ProviderConfigDto[];

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