f655adfbea
Migrate app code into canonical feature slices, add phone-only AI digest scheduling and review, wire local notification/background task support, and cover the flow with tests.
64 lines
1.4 KiB
Dart
64 lines
1.4 KiB
Dart
// ignore_for_file: sort_constructors_first
|
|
|
|
import 'package:flutter/foundation.dart';
|
|
|
|
/// Timeline event stored for a specific relationship.
|
|
@immutable
|
|
class RelationshipMoment {
|
|
const RelationshipMoment({
|
|
required this.id,
|
|
required this.personId,
|
|
required this.title,
|
|
required this.summary,
|
|
required this.at,
|
|
required this.type,
|
|
});
|
|
|
|
final String id;
|
|
final String personId;
|
|
final String title;
|
|
final String summary;
|
|
final DateTime at;
|
|
final String type;
|
|
|
|
RelationshipMoment copyWith({
|
|
String? id,
|
|
String? personId,
|
|
String? title,
|
|
String? summary,
|
|
DateTime? at,
|
|
String? type,
|
|
}) {
|
|
return RelationshipMoment(
|
|
id: id ?? this.id,
|
|
personId: personId ?? this.personId,
|
|
title: title ?? this.title,
|
|
summary: summary ?? this.summary,
|
|
at: at ?? this.at,
|
|
type: type ?? this.type,
|
|
);
|
|
}
|
|
|
|
Map<String, dynamic> toJson() {
|
|
return <String, dynamic>{
|
|
'id': id,
|
|
'personId': personId,
|
|
'title': title,
|
|
'summary': summary,
|
|
'at': at.toUtc().toIso8601String(),
|
|
'type': type,
|
|
};
|
|
}
|
|
|
|
factory RelationshipMoment.fromJson(Map<String, dynamic> json) {
|
|
return RelationshipMoment(
|
|
id: json['id'] as String,
|
|
personId: json['personId'] as String,
|
|
title: json['title'] as String,
|
|
summary: json['summary'] as String,
|
|
at: DateTime.parse(json['at'] as String).toLocal(),
|
|
type: json['type'] as String,
|
|
);
|
|
}
|
|
}
|