Files
bot-pontos/backend/internal/domain/point.go
2026-10-23 22:31:02 -03:00

27 lines
712 B
Go

package domain
import (
"errors"
"time"
)
var ErrInvalidPointHistory = errors.New("histórico de pontos inválido")
type Point struct {
OccurredAt time.Time
}
// Workday são os pontos de um dia, em ordem.
type Workday struct {
Points []Point
Invalid bool // pontos repetidos ou fora de ordem
Overtime bool // mais de quatro pontos (hora extra, fora do escopo)
}
func (w Workday) Count() int { return len(w.Points) }
func (w Workday) Entry1() time.Time { return w.Points[0].OccurredAt }
func (w Workday) Exit1() time.Time { return w.Points[1].OccurredAt }
func (w Workday) Entry2() time.Time { return w.Points[2].OccurredAt }
func (w Workday) Exit2() time.Time { return w.Points[3].OccurredAt }