import '../models/habit.dart'; /// R1/R2: max active habits per type. /// - build: ≤ 3 /// - break: ≤ 1 const int kMaxActiveBuild = 3; const int kMaxActiveBreak = 1; class QuotaResult { final HabitType type; final int currentCount; final int limit; final bool allowed; const QuotaResult({ required this.type, required this.currentCount, required this.limit, required this.allowed, }); String get reason { if (allowed) return 'ok'; return type == HabitType.build ? 'build habit quota reached (≤ $kMaxActiveBuild active)' : 'break habit quota reached (≤ $kMaxActiveBreak active)'; } } /// Pure judgment: caller passes in the current active count. QuotaResult judgeActiveHabitQuota({ required HabitType type, required int currentActiveCount, }) { final limit = type == HabitType.build ? kMaxActiveBuild : kMaxActiveBreak; return QuotaResult( type: type, currentCount: currentActiveCount, limit: limit, allowed: currentActiveCount < limit, ); }