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

export class CreateSystemAdminDto {
  @ApiProperty({ description: '姓名', example: '系统管理员' })
  @IsString({ message: 'name 必须是字符串' })
  name!: string;

  @ApiProperty({ description: '手机号', example: '13800000000' })
  @IsString({ message: 'phone 必须是字符串' })
  phone!: string;

  @ApiProperty({ description: '密码（至少 8 位）', example: 'Admin@12345' })
  @IsString({ message: 'password 必须是字符串' })
  password!: string;

  @ApiPropertyOptional({
    description: '可选微信 openId（院内账号间可复用）',
    example: 'o123abcxyz',
  })
  @IsOptional()
  @IsString({ message: 'openId 必须是字符串' })
  openId?: string;

  @ApiProperty({
    description:
      '系统管理员创建引导密钥（来自环境变量 SYSTEM_ADMIN_BOOTSTRAP_KEY）',
    example: 'init-admin-secret',
  })
  @IsString({ message: 'systemAdminBootstrapKey 必须是字符串' })
  systemAdminBootstrapKey!: string;
}
