summaryrefslogtreecommitdiff
path: root/internal/actions/actions.go
blob: 5e2610aa379341c0291527ef982a94bb3a38ae6c (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
34
package actions

import (
	"context"
	"punchcard/internal/queries"
)

// Actions provides high-level business operations for time tracking
type Actions interface {
	// Timer operations
	PunchIn(ctx context.Context, client, project, description string, billableRate *float64) (*TimerSession, error)
	PunchInMostRecent(ctx context.Context, description string, billableRate *float64) (*TimerSession, error)
	PunchOut(ctx context.Context) (*TimerSession, error)
	
	// Client operations
	CreateClient(ctx context.Context, name, email string, billableRate *float64) (*queries.Client, error)
	FindClient(ctx context.Context, nameOrID string) (*queries.Client, error)
	
	// Project operations  
	CreateProject(ctx context.Context, name, client string, billableRate *float64) (*queries.Project, error)
	FindProject(ctx context.Context, nameOrID string) (*queries.Project, error)
}

// New creates a new Actions instance
func New(q *queries.Queries) Actions {
	return &actionsImpl{
		queries: q,
	}
}

// actionsImpl implements the Actions interface
type actionsImpl struct {
	queries *queries.Queries
}