package domain import ( "fmt" "time" ) type Monitor struct { ID string TribeID int64 GroupID string CreatedAt time.Time } type MonitorWithTribe struct { Monitor Tribe Tribe } type MonitorAlreadyExistsError struct { TribeID int64 GroupID string } var _ TranslatableError = MonitorAlreadyExistsError{} func (e MonitorAlreadyExistsError) Error() string { return fmt.Sprintf("monitor (groupID=%s,tribeID=%d) already exists", e.GroupID, e.TribeID) } func (e MonitorAlreadyExistsError) Slug() string { return "monitor-already-exists" } func (e MonitorAlreadyExistsError) Params() map[string]any { return map[string]any{ "TribeID": e.TribeID, "GroupID": e.GroupID, } } type MonitorLimitReachedError struct { Current int // current number of groups Limit int // max number of groups } var _ TranslatableError = MonitorLimitReachedError{} func (e MonitorLimitReachedError) Error() string { return fmt.Sprintf("monitor limit has been reached (%d/%d)", e.Current, e.Limit) } func (e MonitorLimitReachedError) UserError() string { return e.Error() } func (e MonitorLimitReachedError) Slug() string { return "monitor-limit-reached" } func (e MonitorLimitReachedError) Params() map[string]any { return map[string]any{ "Current": e.Current, "Limit": e.Limit, } } type MonitorNotFoundError struct { ID string } var _ TranslatableError = MonitorNotFoundError{} func (e MonitorNotFoundError) Error() string { return fmt.Sprintf("monitor (id=%s) not found", e.ID) } func (e MonitorNotFoundError) UserError() string { return e.Error() } func (e MonitorNotFoundError) Slug() string { return "monitor-not-found" } func (e MonitorNotFoundError) Params() map[string]any { return map[string]any{ "ID": e.ID, } }