import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger'
import { RoleType } from '@/domain/enums'

/**
 * 用户授权信息
 */
export class UserAuthorizationInfo {
  @ApiProperty({ description: '授权ID' })
  authorizationId: string

  @ApiProperty({ description: '角色类型', enum: RoleType })
  roleType: RoleType

  @ApiProperty({ description: '区域代码' })
  regionCode: string

  @ApiProperty({ description: '区域名称' })
  regionName: string

  @ApiProperty({ description: '显示标题' })
  displayTitle: string

  @ApiProperty({ description: '权益是否激活' })
  benefitActive: boolean
}

/**
 * 用户公开资料响应（所有人可见）
 */
export class UserProfilePublicResponse {
  @ApiProperty({ description: '用户ID' })
  userId: string

  @ApiProperty({ description: '账户序列号' })
  accountSequence: string

  @ApiProperty({ description: '昵称' })
  nickname: string

  @ApiPropertyOptional({ description: '头像URL' })
  avatarUrl?: string

  @ApiProperty({ description: '注册时间' })
  registeredAt: string

  @ApiPropertyOptional({ description: '推荐人序列号' })
  inviterSequence?: string

  @ApiPropertyOptional({ description: '推荐人昵称' })
  inviterNickname?: string

  @ApiProperty({ description: '直推人数' })
  directReferralCount: number

  @ApiProperty({ description: '伞下用户数（团队总人数）' })
  umbrellaUserCount: number

  @ApiPropertyOptional({ description: '所在省份' })
  province?: string

  @ApiPropertyOptional({ description: '所在城市' })
  city?: string

  @ApiProperty({ description: '个人认种数量' })
  personalPlantingCount: number

  @ApiProperty({ description: '团队认种数量' })
  teamPlantingCount: number

  @ApiProperty({ description: '授权列表', type: [UserAuthorizationInfo] })
  authorizations: UserAuthorizationInfo[]
}

/**
 * 用户私密资料响应（仅特权用户可见，继承公开资料）
 */
export class UserProfilePrivateResponse extends UserProfilePublicResponse {
  @ApiPropertyOptional({ description: '手机号（脱敏）' })
  phoneNumber?: string

  @ApiPropertyOptional({ description: '邮箱（脱敏）' })
  email?: string

  @ApiPropertyOptional({ description: '真实姓名（脱敏）' })
  realName?: string

  @ApiProperty({ description: 'KYC状态' })
  kycStatus: string
}
