Files
chinese-family-tree-2/types/family.ts
T
freedakgmail 33cf0c50d1 0.0.0.2
2025-11-22 20:08:07 +08:00

53 lines
1.3 KiB
TypeScript

export type Gender = "male" | "female" | "other"
export type LifeStatus = "living" | "deceased" | "unknown"
export interface FamilyMember {
id: string
// Basic Info
surname: string // 姓
givenName: string // 名
fullName: string // Display name (usually Surname + GivenName)
// Chinese Specifics
generation: number // 世/代 (1-based index from progenitor)
generationName?: string // 字辈/派语
courtesyName?: string // 字
artName?: string // 号
posthumousName?: string // 谥号
gender: Gender
rank?: number // Order among siblings (1 = eldest)
// Dates
birthDate?: string // ISO format or Chinese Lunar Date string
deathDate?: string
isLunarDate?: boolean // If true, display as lunar
// Location
ancestralHome?: string // 籍贯
birthPlace?: string
burialPlace?: string // 墓地 (for deceased)
// Relationships (Adjacency List style)
fatherId?: string
motherId?: string
spouseIds: string[]
childrenIds: string[]
// Content
bio?: string
tags?: string[] // e.g., "Famous", "Official", "Scholar"
avatarUrl?: string
avatarImageId?: string // ID referencing the 'images' table in Dexie
// Metadata
createdAt: string
updatedAt: string
}
export interface FamilyTreeData {
members: Record<string, FamilyMember> // ID -> Member map for O(1) access
rootId?: string // The progenitor
}