summaryrefslogtreecommitdiff
path: root/internal/actions/types.go
blob: caf3dc580b1784a0b6f3e45aab7ac6a882c2faf9 (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
33
package actions

import (
	"errors"
	"time"
)

// Common errors
var (
	ErrNoActiveTimer         = errors.New("no active timer found")
	ErrClientRequired        = errors.New("client is required")
	ErrClientNotFound        = errors.New("client not found")
	ErrProjectNotFound       = errors.New("project not found")
	ErrAmbiguousClient       = errors.New("ambiguous client reference")
	ErrAmbiguousProject      = errors.New("ambiguous project reference")
	ErrProjectClientMismatch = errors.New("project does not belong to specified client")
	ErrNoRecentEntries       = errors.New("no previous time entries found")
	ErrArchivedClient        = errors.New("client is archived")
	ErrArchivedProject       = errors.New("project is archived")
)

// TimerSession represents an active or completed time tracking session
type TimerSession struct {
	ID             int64
	ClientName     string
	ProjectName    string // empty if no project
	Description    string // empty if no description
	StartTime      time.Time
	EndTime        *time.Time // nil if still active
	Duration       time.Duration
	WasNoOp        bool   // true if timer was already active with same parameters
	StoppedEntryID *int64 // ID of previously stopped entry (if any)
}