-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtypes.ts
More file actions
265 lines (227 loc) · 5.39 KB
/
types.ts
File metadata and controls
265 lines (227 loc) · 5.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
export type Language = 'zh' | 'en';
export enum LogType {
FEEDING = 'FEEDING',
DIAPER = 'DIAPER',
CARE = 'CARE',
PLAY = 'PLAY',
WEIGHT = 'WEIGHT',
MILESTONE = 'MILESTONE'
}
export type MemberRole = 'MOM' | 'DAD' | 'PARENTS_TOGETHER' | 'GRANDMOM_MATERNAL' | 'GRANDDAD_MATERNAL' | 'GRANDMOM_PATERNAL' | 'GRANDDAD_PATERNAL' | 'NANNY' | 'OTHER';
export type Gender = 'BOY' | 'GIRL';
export interface UserProfile {
uid: string;
username: string;
email: string;
role: MemberRole;
customRole?: string;
familyId: string;
accessLevel?: 'user' | 'admin';
}
export interface FamilyProfile {
id?: string; // Firestore ID
familyName: string;
fatherName: string;
motherName: string;
babyName: string;
babyBirthDate: Date;
babyGender: Gender;
babyWeight?: number; // Weight in KG
inviteCode: string; // Account linking code
birthGestationalWeeks?: number; // Weeks (e.g., 36)
birthGestationalDays?: number; // Days (0-6)
}
export enum FeedingMethod {
BREAST_BOTTLE = '瓶喂母乳',
FORMULA = '配方奶',
MIXED = '混合喂养',
NURSING = '亲喂'
}
export enum DiaperContent {
PEE = '嘘嘘',
POO = '便便'
}
export enum DiaperAbnormality {
NONE = '无异常',
DIARRHEA = '拉肚子',
CONSTIPATION = '便秘',
OTHER = '其他'
}
export enum CareActivity {
BATH = '洗澡',
NAILS = '剪指甲',
MASSAGE = '按摩',
TEMPERATURE = '体温检测',
MEDICINE = '用药',
UMBILICAL = '脐带护理',
SKIN_CARE = '皮肤护理',
BUTT_CARE = '屁屁护理',
SLEEP = '哄睡'
}
export enum PlayActivity {
READING = '阅读',
PLAYING = '玩耍',
OUTDOOR = '户外活动',
WALKING = '散步',
DRIVING = '开车兜风',
EATING_OUT = '带宝宝吃饭',
TUMMY_TIME = '俯卧撑(Tummy Time)'
}
export interface BaseLog {
id: string;
familyId?: string; // Link to family
timestamp: Date;
type: LogType;
note: string;
author?: MemberRole; // Keep for compatibility
authors: MemberRole[]; // New field for multiple participants
authorCustomRole?: string;
}
export interface FeedingLog extends BaseLog {
type: LogType.FEEDING;
method: FeedingMethod;
amount: number; // in ml
}
export interface DiaperLog extends BaseLog {
type: LogType.DIAPER;
contents: DiaperContent[]; // Can be both pee and poo
abnormality: DiaperAbnormality;
}
export interface CareLog extends BaseLog {
type: LogType.CARE;
activities: CareActivity[];
}
export interface PlayLog extends BaseLog {
type: LogType.PLAY;
activities: PlayActivity[];
}
export interface WeightLog extends BaseLog {
type: LogType.WEIGHT;
weight: number; // in KG (standard storage unit)
}
export interface MilestoneLog extends BaseLog {
type: LogType.MILESTONE;
title: string;
description?: string;
}
export type BabyLog = FeedingLog | DiaperLog | CareLog | PlayLog | WeightLog | MilestoneLog;
export type ViewMode = 'daily' | 'monthly';
export interface ChatMessage {
id: string;
role: 'user' | 'model';
text: string;
timestamp: Date;
draftLog?: Partial<BabyLog>; // For AI to propose a log creation
}
export interface ChatSession {
id: string;
familyId: string;
userId: string;
title: string;
createdAt: Date;
updatedAt: Date;
messages: ChatMessage[];
}
// --- New Types for Planning Mode ---
export enum PlanStatus {
PENDING = 'PENDING',
COMPLETED = 'COMPLETED',
SKIPPED = 'SKIPPED'
}
export interface PlanItem {
id: string;
familyId?: string; // Link to family
type: LogType;
time: Date;
assignee?: MemberRole | 'BOTH'; // Keep for compatibility
assignees: MemberRole[]; // New field for multiple participants
status: PlanStatus;
note: string;
linkedLogId?: string; // If completed, points to the actual log
}
export enum FeedbackCategory {
UI = '界面',
FUNCTION = '功能',
DATA = '数据',
OTHER = '其他'
}
export enum FeedbackActionType {
NEW = '新增',
OPTIMIZATION = '优化'
}
export interface FeedbackItem {
id: string;
content: string;
category?: FeedbackCategory;
actionType?: FeedbackActionType;
isCompleted: boolean;
createdAt: Date;
createdBy: string; // User ID
familyId: string;
}
// --- Requirement Management Types ---
export enum RequirementPriority {
P0 = 'P0',
P1 = 'P1',
P2 = 'P2',
P3 = 'P3'
}
export enum RequirementStatus {
PENDING = 'PENDING',
COMPLETED = 'COMPLETED'
}
export enum RequirementCategory {
INTERFACE = 'INTERFACE',
FUNCTION = 'FUNCTION',
DATA = 'DATA',
OTHER = 'OTHER'
}
export enum RequirementType {
NEW = 'NEW',
OPTIMIZATION = 'OPTIMIZATION'
}
export interface Requirement {
id: string;
content: string;
category: RequirementCategory;
type: RequirementType;
priority: RequirementPriority;
status: RequirementStatus;
createdBy: string;
createdAt?: Date;
}
export enum AchievementCategory {
FAMILY = 'FAMILY',
INDIVIDUAL = 'INDIVIDUAL',
BABY = 'BABY'
}
export enum AchievementTier {
BRONZE = 'BRONZE',
SILVER = 'SILVER',
GOLD = 'GOLD',
PLATINUM = 'PLATINUM',
DIAMOND = 'DIAMOND'
}
export interface Achievement {
id: string;
key: string;
tier: AchievementTier;
category: AchievementCategory;
threshold: number;
title: string;
titleEn: string;
description: string;
descriptionEn: string;
icon: string;
color: string;
explanation?: string;
encouragement?: string;
role?: MemberRole;
}
export interface EarnedMedal {
id: string;
achievementId: string;
userId?: string;
familyId: string;
earnedAt: Date;
}