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 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 json) => _$TaskFromJson(json); Map toJson() => _$TaskToJson(this); }