summaryrefslogtreecommitdiff
path: root/internal/models/widget.go
blob: 1ac082e2a77391b2395d3523195da057bb549803 (plain)
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
package models

import "time"

// WidgetItem is a single item in the widget API response.
// Source values: "doot", "trello", "plantoeat", "calendar", "gtasks"
// Type values:   "task", "event"
type WidgetItem struct {
	ID               string     `json:"id"`
	Title            string     `json:"title"`
	Source           string     `json:"source"`
	Type             string     `json:"type"`
	Start            *time.Time `json:"start,omitempty"` // nil = no specific time (floating task)
	End              *time.Time `json:"end,omitempty"`
	IsAllDay         bool       `json:"is_all_day"`
	IsOverdue        bool       `json:"is_overdue"`
	DueDate          *time.Time `json:"due_date,omitempty"` // doot tasks only -- see TimelineItemToWidgetItem
	URL              string     `json:"url,omitempty"`
	Completable      bool       `json:"completable"` // true = doot task (checkbox shown)
	RecurringEventID string     `json:"recurring_event_id,omitempty"`
	ProjectColor     *string    `json:"project_color,omitempty"`
	ChainPosition    int        `json:"chain_position,omitempty"` // 1-indexed; 0 = not a chain task
	ChainTotal       int        `json:"chain_total,omitempty"`
	BucketState      string     `json:"bucket_state,omitempty"` // "active" when this is a maintenance-bucket item
}

// WidgetResponse is the full /api/widget response body.
type WidgetResponse struct {
	Now          time.Time     `json:"now"`
	Items        []WidgetItem  `json:"items"`
	BudgetStatus *BudgetStatus `json:"budget_status,omitempty"`
}