import { ApiPropertyOptional } from '@nestjs/swagger';
import { IsOptional, IsString, Length, MaxLength } from 'class-validator';

export class UpdatePlayerProfileAssetsDto {
  @ApiPropertyOptional({ description: '当前账号头像URL', maxLength: 255 })
  @IsOptional()
  @IsString({ message: '头像URL必须是字符串' })
  @Length(0, 255, { message: '头像URL长度不能超过255字符' })
  avatar_url?: string;

  @ApiPropertyOptional({ description: '头像图片Base64，服务端保存后写入账号头像URL' })
  @IsOptional()
  @IsString({ message: '头像图片必须是Base64字符串' })
  @MaxLength(5_000_000, { message: '头像图片内容过大' })
  avatar_image_base64?: string;

  @ApiPropertyOptional({ description: '头像图片MIME类型', example: 'image/png' })
  @IsOptional()
  @IsString({ message: '头像MIME类型必须是字符串' })
  @Length(1, 40, { message: '头像MIME类型长度不正确' })
  avatar_mime_type?: string;

  @ApiPropertyOptional({ description: '8x4角色皮肤PNG Base64，服务端保存后授予账号自定义皮肤' })
  @IsOptional()
  @IsString({ message: '角色皮肤图片必须是Base64字符串' })
  @MaxLength(12_000_000, { message: '角色皮肤图片内容过大' })
  skin_image_base64?: string;

  @ApiPropertyOptional({ description: '角色皮肤MIME类型', example: 'image/png' })
  @IsOptional()
  @IsString({ message: '角色皮肤MIME类型必须是字符串' })
  @Length(1, 40, { message: '角色皮肤MIME类型长度不正确' })
  skin_mime_type?: string;

  @ApiPropertyOptional({ description: '自定义角色皮肤名称', maxLength: 40 })
  @IsOptional()
  @IsString({ message: '角色皮肤名称必须是字符串' })
  @Length(1, 40, { message: '角色皮肤名称长度需在1-40字符之间' })
  skin_name?: string;
}
