Initial scaffold: FocusFlow shared Dart package
Models (Task, Streak, StreakEntry, Reward, User, TimeEstimate, CoworkingRoom, ApiResponse), enums (EnergyLevel, TaskStatus, RewardType, RewardStyle), constants (ApiConstants, ErrorCodes, AppLimits), validators, and generated .g.dart files. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
56
lib/src/models/task.dart
Normal file
56
lib/src/models/task.dart
Normal file
@@ -0,0 +1,56 @@
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
part 'task.g.dart';
|
||||
|
||||
@JsonSerializable()
|
||||
class Task {
|
||||
final String id;
|
||||
final String userId;
|
||||
final String title;
|
||||
final String? description;
|
||||
final String status; // pending, in_progress, completed, skipped, archived
|
||||
final int priority; // 0-100, ML-adjusted
|
||||
final String energyLevel; // low, medium, high
|
||||
final int? estimatedMinutes;
|
||||
final int? actualMinutes;
|
||||
final DateTime? dueAt;
|
||||
final DateTime? completedAt;
|
||||
final String? parentTaskId;
|
||||
final double? dopamineScore; // ML-computed 0-100
|
||||
final double noveltyFactor; // decays over time
|
||||
final DateTime? lastInteracted;
|
||||
final int timesPostponed;
|
||||
final List<String> tags;
|
||||
final String? category;
|
||||
final String? color;
|
||||
final int version;
|
||||
final DateTime createdAt;
|
||||
final DateTime? updatedAt;
|
||||
|
||||
const Task({
|
||||
required this.id,
|
||||
required this.userId,
|
||||
required this.title,
|
||||
this.description,
|
||||
this.status = 'pending',
|
||||
this.priority = 0,
|
||||
this.energyLevel = 'medium',
|
||||
this.estimatedMinutes,
|
||||
this.actualMinutes,
|
||||
this.dueAt,
|
||||
this.completedAt,
|
||||
this.parentTaskId,
|
||||
this.dopamineScore,
|
||||
this.noveltyFactor = 1.0,
|
||||
this.lastInteracted,
|
||||
this.timesPostponed = 0,
|
||||
this.tags = const [],
|
||||
this.category,
|
||||
this.color,
|
||||
this.version = 1,
|
||||
required this.createdAt,
|
||||
this.updatedAt,
|
||||
});
|
||||
|
||||
factory Task.fromJson(Map<String, dynamic> json) => _$TaskFromJson(json);
|
||||
Map<String, dynamic> toJson() => _$TaskToJson(this);
|
||||
}
|
||||
Reference in New Issue
Block a user