package domain import ( "fmt" "time" ) type Monitor struct { ID string TribeID int64 GroupID string CreatedAt time.Time } type MonitorWithTribe struct { Monitor Tribe TribeMeta } type MonitorAlreadyExistsError struct { TribeID int64 GroupID string } func (e MonitorAlreadyExistsError) Error() string { return fmt.Sprintf("monitor (groupID=%s,tribeID=%d) already exists", e.GroupID, e.TribeID) } func (e MonitorAlreadyExistsError) UserError() string { return e.Error() } func (e MonitorAlreadyExistsError) Code() ErrorCode { return ErrorCodeAlreadyExists } type MonitorLimitReachedError struct { Current int // current number of groups Limit int // maximum number of groups } 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) Code() ErrorCode { return ErrorCodeValidationError } type MonitorNotFoundError struct { ID string } 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) Code() ErrorCode { return ErrorCodeEntityNotFound }