108 lines
2.2 KiB
TypeScript
108 lines
2.2 KiB
TypeScript
export type ScoreDirection = 'risk' | 'protective' | 'ability' | 'trait' | 'mixed';
|
|
|
|
export interface AssessmentProfile {
|
|
id: string;
|
|
name: string;
|
|
createdAt: string;
|
|
updatedAt: string;
|
|
}
|
|
|
|
export interface ScoreThreshold {
|
|
min: number;
|
|
label: string;
|
|
note?: string;
|
|
}
|
|
|
|
export interface ScoreMetric {
|
|
key: string;
|
|
label: string;
|
|
value: number;
|
|
min?: number;
|
|
max?: number;
|
|
level?: string;
|
|
direction?: ScoreDirection;
|
|
highScoreMeaning?: string;
|
|
thresholds?: ScoreThreshold[];
|
|
}
|
|
|
|
export interface ScoreSummary {
|
|
primary?: ScoreMetric;
|
|
metrics: ScoreMetric[];
|
|
note?: string;
|
|
questionnaireVersion: string;
|
|
scoreVersion: string;
|
|
min: number;
|
|
max?: number;
|
|
reverseItems: number[];
|
|
direction: ScoreDirection;
|
|
highScoreMeaning: string;
|
|
thresholds: ScoreThreshold[];
|
|
scoringStatus: 'structured' | 'raw';
|
|
}
|
|
|
|
export interface RecordedAnswer {
|
|
questionId: number;
|
|
question: string;
|
|
value: string;
|
|
answer: string;
|
|
}
|
|
|
|
export interface AssessmentRecord {
|
|
id: string;
|
|
profileId: string;
|
|
questionnaireId: string;
|
|
questionnaireTitle: string;
|
|
questionnaireVersion: string;
|
|
scoreVersion: string;
|
|
category: string;
|
|
completedAt: string;
|
|
answers: RecordedAnswer[];
|
|
scoreSummary: ScoreSummary;
|
|
analysisText?: string;
|
|
retestSuitable?: boolean;
|
|
recommendedInterval?: '1年' | '3个月' | '一次即可';
|
|
}
|
|
|
|
export interface EncryptedRecordPayload {
|
|
format: 'mindscope-encrypted-record';
|
|
version: 1;
|
|
algorithm: 'AES-GCM';
|
|
keyScope: 'device' | 'anonymous-profile';
|
|
kdf?: 'PBKDF2-SHA256';
|
|
iterations?: number;
|
|
salt?: string;
|
|
iv: string;
|
|
data: string;
|
|
}
|
|
|
|
export interface EncryptedAssessmentRecord {
|
|
id: string;
|
|
profileId: string;
|
|
questionnaireId: string;
|
|
questionnaireTitle: string;
|
|
questionnaireVersion: string;
|
|
scoreVersion: string;
|
|
category: string;
|
|
completedAt: string;
|
|
encrypted: true;
|
|
payload: EncryptedRecordPayload;
|
|
}
|
|
|
|
export interface EncryptedMindScopeBackup {
|
|
format: 'mindscope-encrypted-backup';
|
|
version: 1;
|
|
algorithm: 'AES-GCM';
|
|
iterations: number;
|
|
salt: string;
|
|
iv: string;
|
|
data: string;
|
|
}
|
|
|
|
export interface MindScopeBackup {
|
|
format: 'mindscope-backup';
|
|
version: 1;
|
|
exportedAt: string;
|
|
profiles: AssessmentProfile[];
|
|
records: AssessmentRecord[];
|
|
}
|