-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtypes.ts
More file actions
183 lines (161 loc) · 3.87 KB
/
types.ts
File metadata and controls
183 lines (161 loc) · 3.87 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
export type Language = 'en' | 'zh';
export interface CycleEvent {
id: string;
date: string; // ISO string YYYY-MM-DD
type: 'period_start' | 'period_end' | 'symptom';
note?: string;
// Extended properties to preserve imported data fidelity
flow?: string;
symptoms?: string[];
mood?: string[];
}
export interface UserSettings {
avgCycleLength: number; // default 28
avgPeriodLength: number; // default 5
language: Language;
qimen?: QimenSettings; // 奇门遁甲设置(可选)
}
export enum Phase {
Menstrual = 'Menstrual',
Follicular = 'Follicular',
Ovulation = 'Ovulation',
Luteal = 'Luteal',
}
export interface AiCyclePrediction {
nextPeriodDate: string; // YYYY-MM-DD
predictedCycleLength: number;
confidence: 'high' | 'medium' | 'low';
reasoning: string;
// 增强字段:更自然的预测表达
relativeDate: string; // "明天"、"后天"、"3天后"
symptomAnalysis?: string; // 症状分析摘要(可选)
}
export interface AppData {
version: number;
settings: UserSettings;
events: CycleEvent[];
lastPrediction?: AiCyclePrediction;
}
// --- External Import/Export Types ---
export interface ExternalPeriodDataEntry {
date: string; // ISO string with time e.g. 2024-11-10T00:00:00.000
end_date: string | null;
flow?: string;
symptoms?: string[];
mood?: string[];
notes?: string;
}
export interface ExternalSettings {
notifications_enabled: boolean;
reminder_days: number;
export_format: string;
}
export interface ExternalData {
settings: ExternalSettings;
period_data: ExternalPeriodDataEntry[];
}
// --- Qimen Dunjia (奇门遁甲) Types ---
/** 九宫位置 */
export type Palace = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9;
/** 八门 */
export type Gate =
| '休门'
| '生门'
| '伤门'
| '杜门'
| '景门'
| '死门'
| '惊门'
| '开门';
/** 九星 */
export type Star =
| '天蓬'
| '天芮'
| '天冲'
| '天辅'
| '天禽'
| '天心'
| '天柱'
| '天任'
| '天英';
/** 八神 */
export type Spirit =
| '值符'
| '腾蛇'
| '太阴'
| '六合'
| '白虎'
| '玄武'
| '九地'
| '九天';
/** 奇门盘式类型 */
export type QimenPanStyle = '转盘' | '飞盘';
/** 奇门盘类型 */
export type QimenPanType = '时盘' | '日盘' | '月盘' | '年盘';
/** 单个宫位信息 */
export interface QimenPalaceInfo {
palace: Palace;
palaceName: string; // 乾、坎、艮、震、中、巽、离、坤、兑
earthStem: string; // 地盘干
heavenStem: string; // 天盘干
gate: Gate;
star: Star;
spirit: Spirit;
isEmpty: boolean; // 是否空亡
hasHorse: boolean; // 是否有马星
}
/** 格局信息 */
export interface QimenPattern {
name: string;
type: 'good' | 'bad' | 'neutral';
description: string;
palace: Palace;
}
/** 完整奇门盘 */
export interface QimenChart {
// 基本信息
datetime: string; // ISO datetime
solarTerms: string; // 节气
ganZhi: {
year: string;
month: string;
day: string;
hour: string;
};
// 盘局信息
yinYang: '阳遁' | '阴遁';
juNumber: number; // 局数 1-9
panStyle: QimenPanStyle;
panType: QimenPanType;
// 值符值使
zhiFu: { star: Star; palace: Palace };
zhiShi: { gate: Gate; palace: Palace };
// 九宫详情
palaces: QimenPalaceInfo[];
// 格局分析
patterns: QimenPattern[];
// 空亡
kongWang: string[];
}
/** 奇门健康运势分析 */
export interface QimenHealthInsight {
date: string;
overallRating: 'good' | 'neutral' | 'caution';
summary: string;
details: string[];
recommendations: string[];
disclaimer: string;
}
/** 奇门择日结果 */
export interface QimenAuspiciousTime {
datetime: string;
score: number; // 0-100
rating: '优' | '良' | '中' | '差';
reasons: string[];
cautions: string[];
}
/** 用户设置中的奇门选项 */
export interface QimenSettings {
enabled: boolean;
panStyle: QimenPanStyle;
}