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

47 lines
1.3 KiB
Go

package domain
// QueryWindow são os horários da janela de consulta à PontoMais (ARQUITETURA.md 9.12).
type QueryWindow struct {
Start ClockTime
End ClockTime
DayCheckDeadline ClockTime
NoPointsRecheckUntil ClockTime
}
func DefaultQueryWindow() QueryWindow {
return QueryWindow{
Start: MustParseClock("11:30"),
End: MustParseClock("19:00"),
DayCheckDeadline: MustParseClock("11:45"),
NoPointsRecheckUntil: MustParseClock("15:00"),
}
}
// WorkSchedule são as regras de jornada do usuário e a exceção opcional de janela (9.14).
type WorkSchedule struct {
UserID int64
LunchMinutes int
DailyWorkMinutes int
Entrada2LeadMinutes int
Saida2LeadMinutes int
Window *QueryWindow // nil = usa a janela global
}
func DefaultSchedule(userID int64) WorkSchedule {
return WorkSchedule{
UserID: userID,
LunchMinutes: 60,
DailyWorkMinutes: 480,
Entrada2LeadMinutes: 5,
Saida2LeadMinutes: 5,
}
}
// LeadMinutes devolve a antecedência configurada para o tipo de lembrete.
func (s WorkSchedule) LeadMinutes(t NotificationType) int {
if t == NotificationSaida2 {
return s.Saida2LeadMinutes
}
return s.Entrada2LeadMinutes
}