import { IsNotEmpty, IsNumber, IsIn } from 'class-validator';
import { Type } from 'class-transformer';
import { ApiProperty } from '@nestjs/swagger';
import { WalletTransactionType, WalletTransactionReason } from '../interface/wallet';

export class CreateWalletTransactionDto {
  @ApiProperty({
    description: 'Transaction amount',
    type: Number,
    example: 1000,
  })
  @IsNotEmpty()
  @IsNumber()
  @Type(() => Number)
  amount!: number;

  @ApiProperty({
    description: 'Transaction type',
    enum: WalletTransactionType,
    example: WalletTransactionType.CREDIT,
  })
  @IsNotEmpty()
  @IsIn(Object.values(WalletTransactionType))
  type!: WalletTransactionType;

  @ApiProperty({
    description: 'Transaction reason',
    enum: WalletTransactionReason,
    example: WalletTransactionReason.ORDER_PAYMENT,
  })
  @IsNotEmpty()
  @IsIn(Object.values(WalletTransactionReason))
  reason!: WalletTransactionReason;
}
