/** * TypeScript models for GlowTrack data structures * * Based on the data model specification for mood and habit tracking * with wellbeing grid visualization. */ /** * Color blind accessibility modes supported by the application */ export type ColorBlindMode = 'none' | 'protanopia' | 'deuteranopia' | 'tritanopia'; /** * Type of habit entry - positive contributes to wellbeing, negative detracts */ export type HabitType = 'positive' | 'negative'; /** * Settings for PNG export functionality */ export interface ExportSettings { /** Scale factor for PNG export (1.0 = screen resolution) */ pngScale: number; /** Whether to include legend in exported PNG */ includeLegend: boolean; } /** * Configuration settings for the wellbeing grid */ export interface GridSettings { /** Start date for the grid view (ISO date YYYY-MM-DD) */ startDate: string; /** End date for the grid view (ISO date YYYY-MM-DD) */ endDate: string; /** Theme palette identifier */ theme: string; /** Color blind accessibility mode */ colorBlindMode: ColorBlindMode; /** Export configuration */ export: ExportSettings; } /** * Mood state for a specific day */ export interface Mood { /** Hue value (0-360 degrees) */ hue: number; /** Intensity level (0-1) */ intensity: number; /** Optional note about the mood */ note?: string; } /** * Definition of a habit that can be tracked */ export interface HabitDefinition { /** Unique identifier for the habit */ id: string; /** Type of habit (positive or negative) */ type: HabitType; /** Display label for the habit */ label: string; /** Optional icon identifier for UI glyphs */ icon?: string; /** Default weight for new entries of this habit */ defaultWeight: number; /** Whether this habit is archived (no longer actively tracked) */ archived: boolean; } /** * A single habit entry for a specific day */ export interface HabitEntry { /** Unique identifier for this entry */ id: string; /** Type of habit entry */ type: HabitType; /** Reference to the habit definition */ habitId: string; /** Display label (may differ from habit definition) */ label: string; /** Weight of this entry (always positive, type determines sign for net score) */ weight: number; /** When this entry was created */ timestamp: string; } /** * Data for a single day tile in the wellbeing grid */ export interface DayTile { /** Date for this tile (ISO date YYYY-MM-DD) */ date: string; /** Mood state for this day */ mood: Mood; /** Habit entries for this day */ entries: HabitEntry[]; /** Derived net score: sum(positive weights) - sum(negative weights) */ netScore: number; } /** * Complete wellbeing grid data structure */ export interface WellbeingGrid { /** Stable unique identifier for this grid */ id: string; /** When this grid was created (ISO datetime) */ createdAt: string; /** When this grid was last updated (ISO datetime) */ updatedAt: string; /** Grid configuration settings */ settings: GridSettings; /** Day tiles that make up the grid */ days: DayTile[]; }