import { IsString, IsNotEmpty, IsOptional, IsNumber, IsBoolean, MinLength, MaxLength, IsIn, Min, } from 'class-validator'; import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger'; export class CreateBrokerDto { @ApiProperty({ description: '券商代码', example: 'HTZQ', maxLength: 50, }) @IsString() @IsNotEmpty() @MinLength(1) @MaxLength(50) brokerCode: string; @ApiProperty({ description: '券商名称', example: '华泰证券', maxLength: 100, }) @IsString() @IsNotEmpty() @MinLength(1) @MaxLength(100) brokerName: string; @ApiProperty({ description: '地区/国家代码', example: 'CN', enum: ['CN', 'US', 'HK', 'SG', 'JP', 'UK', 'AU', 'CA', 'OTHER'], }) @IsString() @IsNotEmpty() @IsIn(['CN', 'US', 'HK', 'SG', 'JP', 'UK', 'AU', 'CA', 'OTHER']) region: string; @ApiPropertyOptional({ description: '排序顺序', example: 1, minimum: 0, default: 0, }) @IsOptional() @IsNumber() @Min(0) sortOrder?: number; @ApiPropertyOptional({ description: '是否启用', example: true, default: true, }) @IsOptional() @IsBoolean() isActive?: boolean; @ApiPropertyOptional({ description: '券商图片地址', example: 'https://example.com/broker-image.jpg', maxLength: 200, }) @IsOptional() @IsString() @MaxLength(200) brokerImage?: string; }