···23import (
4 "encoding/json"
05 "net/url"
6 "slices"
7 "time"
···311}
312313// IsStarted returns true if the task has a start time set.
314-func (t *Task) IsStarted() bool {
315- return t.Start != nil
316-}
317318// IsOverdue returns true if the task is overdue.
319func (t *Task) IsOverdue(now time.Time) bool {
···321}
322323// HasDueDate returns true if the task has a due date set.
324-func (t *Task) HasDueDate() bool {
325- return t.Due != nil
326-}
327328// IsRecurring returns true if the task has recurrence defined.
329-func (t *Task) IsRecurring() bool {
330- return t.Recur != ""
331-}
332333// IsRecurExpired checks if the recurrence has an end (until) date and is past it.
334func (t *Task) IsRecurExpired(now time.Time) bool {
···336}
337338// HasDependencies returns true if the task depends on other tasks.
339-func (t *Task) HasDependencies() bool {
340- return len(t.DependsOn) > 0
341-}
342343// Blocks checks if this task blocks another given task.
344func (t *Task) Blocks(other *Task) bool {
···361 return score
362}
36300000000000364// IsWatched returns true if the movie has been watched
365-func (m *Movie) IsWatched() bool {
366- return m.Status == "watched"
367-}
368369// IsQueued returns true if the movie is in the queue
370-func (m *Movie) IsQueued() bool {
371- return m.Status == "queued"
372-}
0000000000373374// IsWatching returns true if the TV show is currently being watched
375-func (tv *TVShow) IsWatching() bool {
376- return tv.Status == "watching"
377-}
378379// IsWatched returns true if the TV show has been watched
380-func (tv *TVShow) IsWatched() bool {
381- return tv.Status == "watched"
382-}
383384// IsQueued returns true if the TV show is in the queue
385-func (tv *TVShow) IsQueued() bool {
386- return tv.Status == "queued"
000000387}
388000000389// IsReading returns true if the book is currently being read
390-func (b *Book) IsReading() bool {
391- return b.Status == "reading"
392-}
393394// IsFinished returns true if the book has been finished
395-func (b *Book) IsFinished() bool {
396- return b.Status == "finished"
397-}
398399// IsQueued returns true if the book is in the queue
400-func (b *Book) IsQueued() bool {
401- return b.Status == "queued"
402-}
403404// ProgressPercent returns the reading progress as a percentage
405-func (b *Book) ProgressPercent() int {
406- return b.Progress
0000000000000000000000407}
408409func (t *Task) GetID() int64 { return t.ID }
···23import (
4 "encoding/json"
5+ "fmt"
6 "net/url"
7 "slices"
8 "time"
···312}
313314// IsStarted returns true if the task has a start time set.
315+func (t *Task) IsStarted() bool { return t.Start != nil }
00316317// IsOverdue returns true if the task is overdue.
318func (t *Task) IsOverdue(now time.Time) bool {
···320}
321322// HasDueDate returns true if the task has a due date set.
323+func (t *Task) HasDueDate() bool { return t.Due != nil }
00324325// IsRecurring returns true if the task has recurrence defined.
326+func (t *Task) IsRecurring() bool { return t.Recur != "" }
00327328// IsRecurExpired checks if the recurrence has an end (until) date and is past it.
329func (t *Task) IsRecurExpired(now time.Time) bool {
···331}
332333// HasDependencies returns true if the task depends on other tasks.
334+func (t *Task) HasDependencies() bool { return len(t.DependsOn) > 0 }
00335336// Blocks checks if this task blocks another given task.
337func (t *Task) Blocks(other *Task) bool {
···354 return score
355}
356357+// GetStatus returns the current status of the task
358+func (t *Task) GetStatus() string { return t.Status }
359+360+// ValidStatuses returns all valid status values for a task
361+func (t *Task) ValidStatuses() []string {
362+ return []string{
363+ StatusTodo, StatusInProgress, StatusBlocked, StatusDone, StatusAbandoned,
364+ StatusPending, StatusCompleted, StatusDeleted,
365+ }
366+}
367+368// IsWatched returns true if the movie has been watched
369+func (m *Movie) IsWatched() bool { return m.Status == "watched" }
00370371// IsQueued returns true if the movie is in the queue
372+func (m *Movie) IsQueued() bool { return m.Status == "queued" }
373+374+// GetStatus returns the current status of the movie
375+func (m *Movie) GetStatus() string { return m.Status }
376+377+// ValidStatuses returns all valid status values for a movie
378+func (m *Movie) ValidStatuses() []string { return []string{"queued", "watched", "removed"} }
379+380+// IsCompleted returns true if the movie has been watched
381+func (m *Movie) IsCompleted() bool { return m.Status == "watched" }
382+383+// GetCompletionTime returns when the movie was watched
384+func (m *Movie) GetCompletionTime() *time.Time { return m.Watched }
385386// IsWatching returns true if the TV show is currently being watched
387+func (tv *TVShow) IsWatching() bool { return tv.Status == "watching" }
00388389// IsWatched returns true if the TV show has been watched
390+func (tv *TVShow) IsWatched() bool { return tv.Status == "watched" }
00391392// IsQueued returns true if the TV show is in the queue
393+func (tv *TVShow) IsQueued() bool { return tv.Status == "queued" }
394+395+// GetStatus returns the current status of the TV show
396+func (tv *TVShow) GetStatus() string { return tv.Status }
397+398+// ValidStatuses returns all valid status values for a TV show
399+func (tv *TVShow) ValidStatuses() []string {
400+ return []string{"queued", "watching", "watched", "removed"}
401}
402403+// IsCompleted returns true if the TV show has been watched
404+func (tv *TVShow) IsCompleted() bool { return tv.Status == "watched" }
405+406+// GetCompletionTime returns when the TV show was last watched
407+func (tv *TVShow) GetCompletionTime() *time.Time { return tv.LastWatched }
408+409// IsReading returns true if the book is currently being read
410+func (b *Book) IsReading() bool { return b.Status == "reading" }
00411412// IsFinished returns true if the book has been finished
413+func (b *Book) IsFinished() bool { return b.Status == "finished" }
00414415// IsQueued returns true if the book is in the queue
416+func (b *Book) IsQueued() bool { return b.Status == "queued" }
00417418// ProgressPercent returns the reading progress as a percentage
419+func (b *Book) ProgressPercent() int { return b.Progress }
420+421+// GetStatus returns the current status of the book
422+func (b *Book) GetStatus() string { return b.Status }
423+424+// ValidStatuses returns all valid status values for a book
425+func (b *Book) ValidStatuses() []string { return []string{"queued", "reading", "finished", "removed"} }
426+427+// IsCompleted returns true if the book has been finished
428+func (b *Book) IsCompleted() bool { return b.Status == "finished" }
429+430+// GetCompletionTime returns when the book was finished
431+func (b *Book) GetCompletionTime() *time.Time { return b.Finished }
432+433+// GetProgress returns the reading progress percentage (0-100)
434+func (b *Book) GetProgress() int { return b.Progress }
435+436+// SetProgress sets the reading progress percentage (0-100)
437+func (b *Book) SetProgress(progress int) error {
438+ if progress < 0 || progress > 100 {
439+ return fmt.Errorf("progress must be between 0 and 100, got %d", progress)
440+ }
441+ b.Progress = progress
442+ return nil
443}
444445func (t *Task) GetID() int64 { return t.ID }