import { IsOptional, IsInt, Min, IsEnum } from 'class-validator';
import { Type } from 'class-transformer';
import { ApiPropertyOptional } from '@nestjs/swagger';

export class QueryUserAccountsDto {
  @ApiPropertyOptional({ description: '页码', example: 1 })
  @IsOptional()
  @Type(() => Number)
  @IsInt()
  @Min(1)
  page?: number = 1;

  @ApiPropertyOptional({ description: '每页数量', example: 10 })
  @IsOptional()
  @Type(() => Number)
  @IsInt()
  @Min(1)
  pageSize?: number = 10;

  @ApiPropertyOptional({ description: '账户状态', enum: ['active', 'frozen', 'closed'] })
  @IsOptional()
  @IsEnum(['active', 'frozen', 'closed'])
  status?: string;

  @ApiPropertyOptional({ description: '用户ID' })
  @IsOptional()
  @Type(() => Number)
  @IsInt()
  userId?: number;
}

export class QueryMerchantAccountsDto {
  @ApiPropertyOptional({ description: '页码', example: 1 })
  @IsOptional()
  @Type(() => Number)
  @IsInt()
  @Min(1)
  page?: number = 1;

  @ApiPropertyOptional({ description: '每页数量', example: 10 })
  @IsOptional()
  @Type(() => Number)
  @IsInt()
  @Min(1)
  pageSize?: number = 10;

  @ApiPropertyOptional({ description: '账户状态', enum: ['active', 'frozen', 'closed'] })
  @IsOptional()
  @IsEnum(['active', 'frozen', 'closed'])
  status?: string;

  @ApiPropertyOptional({ description: '商家ID' })
  @IsOptional()
  @Type(() => Number)
  @IsInt()
  merchantId?: number;
}
