import 'package:hive/hive.dart'; part 'user_profile.g.dart'; @HiveType(typeId: 1) class UserProfile extends HiveObject { @HiveField(0) // DEPRECATED: String? mbtiType; // Hive indices must not be reused or reordered carelessly. // Ideally we keep the index but ignore it, or just use the old index for new logic. // The user review suggested: "Remove old fields... or unify". // Since we already used new indices (6, 7) in the previous step and ran build_runner, // keeping 6 and 7 is safer if we want to avoid migration issues with recently created data. // But since this is dev, clean up is better. // However, I will follow the user's advice to remove the old ones. // I will comment them out to reserve the index if needed, or just remove. // Let's remove them and their constructor args. @HiveField(2) String fontPreference; // "serif" or "sans" @HiveField(3) DateTime createdAt; @HiveField(4) DateTime? updatedAt; @HiveField(5) String displayMode; // "list" or "grid" @HiveField(6) String? mbti; @HiveField(7) DateTime? birthdate; @HiveField(8) String themeMode; // 'system', 'light', 'dark' @HiveField(9, defaultValue: false) bool isBusinessMode; @HiveField(10, defaultValue: 3.0) double defaultMarkup; @HiveField(11, defaultValue: false) bool hasCompletedOnboarding; @HiveField(12) String? nickname; @HiveField(13) String? gender; // 'male', 'female', 'other', null UserProfile({ this.fontPreference = 'sans', this.displayMode = 'list', required this.createdAt, this.updatedAt, this.mbti, this.birthdate, this.themeMode = 'system', this.isBusinessMode = false, this.defaultMarkup = 3.0, this.hasCompletedOnboarding = false, this.nickname, this.gender, }); UserProfile copyWith({ String? fontPreference, String? displayMode, DateTime? createdAt, DateTime? updatedAt, String? mbti, DateTime? birthdate, String? themeMode, bool? isBusinessMode, double? defaultMarkup, bool? hasCompletedOnboarding, String? nickname, String? gender, }) { return UserProfile( fontPreference: fontPreference ?? this.fontPreference, displayMode: displayMode ?? this.displayMode, createdAt: createdAt ?? this.createdAt, updatedAt: updatedAt ?? this.updatedAt, mbti: mbti ?? this.mbti, birthdate: birthdate ?? this.birthdate, themeMode: themeMode ?? this.themeMode, isBusinessMode: isBusinessMode ?? this.isBusinessMode, defaultMarkup: defaultMarkup ?? this.defaultMarkup, hasCompletedOnboarding: hasCompletedOnboarding ?? this.hasCompletedOnboarding, nickname: nickname ?? this.nickname, gender: gender ?? this.gender, ); } }