package jobs import ( "fmt" "strings" "github.com/treytartt/honeydue-api/internal/models" ) // BuildDigestMessage constructs the daily digest notification text. func BuildDigestMessage(overdueCount, dueThisWeekCount int) (title, body string) { title = "Daily Task Summary" if overdueCount > 0 && dueThisWeekCount > 0 { body = fmt.Sprintf("You have %d overdue task(s) and %d task(s) due this week", overdueCount, dueThisWeekCount) } else if overdueCount > 0 { body = fmt.Sprintf("You have %d overdue task(s) that need attention", overdueCount) } else { body = fmt.Sprintf("You have %d task(s) due this week", dueThisWeekCount) } return } // IsOverdueStage checks if a reminder stage string represents overdue. func IsOverdueStage(stage string) bool { return strings.HasPrefix(stage, "overdue") } // ExtractFrequencyDays gets interval days from a task's frequency. func ExtractFrequencyDays(t *models.Task) *int { if t.Frequency != nil && t.Frequency.Days != nil { days := *t.Frequency.Days return &days } if t.CustomIntervalDays != nil { days := *t.CustomIntervalDays return &days } return nil }