package models import "time" // Task represents a task from Todoist type Task struct { ID string `json:"id"` Content string `json:"content"` Description string `json:"description"` ProjectID string `json:"project_id"` ProjectName string `json:"project_name"` DueDate *time.Time `json:"due_date,omitempty"` Priority int `json:"priority"` Completed bool `json:"completed"` Labels []string `json:"labels"` URL string `json:"url"` CreatedAt time.Time `json:"created_at"` IsRecurring bool `json:"is_recurring"` } // Meal represents a meal from PlanToEat type Meal struct { ID string `json:"id"` RecipeName string `json:"recipe_name"` Date time.Time `json:"date"` MealType string `json:"meal_type"` // breakfast, lunch, dinner RecipeURL string `json:"recipe_url"` } // ShoppingItem represents an item on the PlanToEat shopping list type ShoppingItem struct { ID string `json:"id"` Name string `json:"name"` Quantity string `json:"quantity"` Category string `json:"category"` Store string `json:"store"` Checked bool `json:"checked"` } // UnifiedShoppingItem combines Trello cards and PlanToEat items type UnifiedShoppingItem struct { ID string `json:"id"` Name string `json:"name"` Quantity string `json:"quantity,omitempty"` Category string `json:"category,omitempty"` Store string `json:"store"` Source string `json:"source"` // "trello" or "plantoeat" Checked bool `json:"checked"` } // ShoppingStore groups items by store type ShoppingStore struct { Name string Categories []ShoppingCategory } // ShoppingCategory groups items within a store type ShoppingCategory struct { Name string Items []UnifiedShoppingItem } // List represents a Trello list type List struct { ID string `json:"id"` Name string `json:"name"` } // Board represents a Trello board type Board struct { ID string `json:"id"` Name string `json:"name"` Cards []Card `json:"cards"` Lists []List `json:"lists"` } // Card represents a Trello card type Card struct { ID string `json:"id"` Name string `json:"name"` ListID string `json:"list_id"` ListName string `json:"list_name"` BoardName string `json:"board_name"` DueDate *time.Time `json:"due_date,omitempty"` URL string `json:"url"` } // Project represents a Todoist project type Project struct { ID string `json:"id"` Name string `json:"name"` } // CalendarEvent represents a Google Calendar event type CalendarEvent struct { ID string `json:"id"` Summary string `json:"summary"` Description string `json:"description"` Start time.Time `json:"start"` End time.Time `json:"end"` HTMLLink string `json:"html_link"` } // Bug represents a bug report type Bug struct { ID int64 `json:"id"` Description string `json:"description"` CreatedAt time.Time `json:"created_at"` } // CacheMetadata tracks when data was last fetched type CacheMetadata struct { Key string `json:"key"` LastFetch time.Time `json:"last_fetch"` TTLMinutes int `json:"ttl_minutes"` } // IsCacheValid checks if the cache is still valid based on TTL func (cm *CacheMetadata) IsCacheValid() bool { expiryTime := cm.LastFetch.Add(time.Duration(cm.TTLMinutes) * time.Minute) return time.Now().Before(expiryTime) } // DashboardData aggregates all data for the main view type DashboardData struct { Tasks []Task `json:"tasks"` Meals []Meal `json:"meals"` Boards []Board `json:"boards,omitempty"` TrelloTasks []Card `json:"trello_tasks,omitempty"` Projects []Project `json:"projects,omitempty"` Events []CalendarEvent `json:"events,omitempty"` LastUpdated time.Time `json:"last_updated"` Errors []string `json:"errors,omitempty"` }