/**
 * @aurora-catalyst-generated
 * @source cliter/iam/user.aurora.yaml
 */
import { ApiProperty } from '@nestjs/swagger';

export class IamUpdateUserByIdDto {
  @ApiProperty({
    type: String,
    description:
      'Unique identifier for the user. UUID v4 format, generated automatically on creation. Used as primary key for referencing this user across the system.',
  })
  id: string;

  @ApiProperty({
    type: String,
    description:
      'Reference to the associated account entity (one-to-one relationship). Each user must be linked to exactly one account, which handles authentication, authorization, and role assignments. The account contains type, email, username, and OAuth client information. This separation allows service accounts to exist without user profiles, while user accounts always have profile data. Must reference an existing active account.',
    example: '2416bff4-0667-5c51-bfa8-728f9a07454f',
  })
  accountId?: string;

  @ApiProperty({
    type: String,
    description:
      "User's first name or given name. Required field for all user accounts. Used in UI displays, email communications, and audit logs. Maximum 128 characters to accommodate international names with special characters. Should be stored as provided by the user without normalization to respect cultural naming conventions. This is separate from the account username used for authentication.",
  })
  name?: string;

  @ApiProperty({
    type: String,
    description:
      "User's last name or family name. Optional field (NULL allowed) as some cultures may not use surnames. Maximum 255 characters to accommodate compound or hyphenated surnames. Used together with 'name' for full name display and formal communications. NULL indicates no surname provided or applicable.",
  })
  surname?: string;

  @ApiProperty({
    type: String,
    description:
      "URL or file path to the user's profile picture/avatar image. Maximum 255 characters for file path or URL. NULL indicates no avatar set (system should display default placeholder). Should reference secure storage (cloud storage bucket, CDN, or protected local path). For security, validate file type and size before storage. Used in UI headers, comments, and user listings. Example formats: /storage/avatars/uuid.jpg or https://cdn.example.com/avatars/uuid.png.",
  })
  avatar?: string;

  @ApiProperty({
    type: String,
    description:
      "User's mobile phone number in international format. Optional field (NULL allowed). Maximum 64 characters to accommodate international numbers with country codes and extensions. Should be stored in E.164 format when possible (e.g., +14155552671) for consistency. Used for SMS notifications, 2FA via SMS, and emergency contact. NULL indicates no mobile number provided. Consider GDPR implications for storage.",
  })
  mobile?: string;

  @ApiProperty({
    type: String,
    description:
      "Reference to the user's preferred language/locale for UI and communications. Links to common/lang module for internationalization (i18n) support. NULL indicates system default language should be used. When set, all emails, notifications, and UI elements should be rendered in this language. Example: links to 'en-US', 'es-ES', 'fr-FR' language records. Used by frontend for locale selection and backend for localized email templates.",
  })
  langId?: string;

  @ApiProperty({
    type: String,
    description:
      'Hashed password for user authentication. NEVER stored in plain text. Aurora automatically applies bcrypt hashing with salt (work factor 10-12). Maximum 255 characters to accommodate hashed output (bcrypt produces 60 chars, but allows room for future algorithm changes). Required field - users must set password on creation. Updated through secure password change flows with current password verification. Used in authentication middleware for login validation. Password reset flows bypass this through token-based validation (see rememberToken). Minimum requirements enforced at application layer: 8+ characters, complexity rules.',
  })
  password?: string;

  @ApiProperty({
    type: Boolean,
    description:
      'Indicates whether two-factor authentication (2FA/MFA) is enabled for this user. When true, login requires both password AND time-based one-time password (TOTP) from authenticator app. Defaults to false (2FA disabled) - users must explicitly enable and configure 2FA. When enabled, twoFactorAuthenticationSecret must be set. Enhances account security by requiring a second authentication factor. Cannot be disabled without proper identity verification to prevent account takeover.',
  })
  isTwoFactorAuthenticationEnabled?: boolean;

  @ApiProperty({
    type: String,
    description:
      'Base32-encoded secret key for TOTP (Time-based One-Time Password) generation. Up to 32 characters in Base32 alphabet (A-Z, 2-7) per RFC 4648 and RFC 6238. Longer secrets (160+ bits) provide stronger security against brute-force attacks. NULL when 2FA is disabled. Generated during 2FA setup and shared with user via QR code for authenticator app (Google Authenticator, Authy, etc.). MUST be stored encrypted at rest for security. Used by authentication service to validate TOTP codes during login. Should NEVER be exposed in APIs or logs. If compromised, must be regenerated through 2FA reset flow. Paired with isTwoFactorAuthenticationEnabled.',
  })
  twoFactorAuthenticationSecret?: string;

  @ApiProperty({
    type: String,
    description:
      'Secure token for "remember me" functionality and password reset workflows. NULL when not in use. Generated as cryptographically secure random string (recommended: 64+ characters, URL-safe). Used for two purposes: 1) Password reset: Temporary token sent via email, single-use, expires after 15-60 minutes. Invalidated after use or password change.2) Remember me: Long-lived token stored in browser cookie for auto-login, expires after 30-90 days of inactivity.Should be hashed before storage for security. Regenerated on each use or invalidated on security events (password change, logout from all devices). NEVER expose in logs or error messages.',
  })
  rememberToken?: string;

  @ApiProperty({
    type: Object,
    description:
      'Optional JSONB field for storing custom user metadata and preferences. Use for application-specific data that doesn\'t warrant dedicated columns. Common uses: UI preferences (theme, layout), notification settings, onboarding status, feature flags, custom profile fields, integration metadata. NULL indicates no custom metadata. Uses JSONB (PostgreSQL) for efficient querying and indexing. No schema validation - structure determined by application. Example: {"theme": "dark", "emailNotifications": true, "onboardingComplete": true} Avoid storing sensitive data here - use dedicated encrypted fields instead.',
  })
  meta?: any;
}
