package entity type Action int8 const ( ActionLog Action = 1 ActionReplace Action = 2 ActionReject Action = 3 ActionHide Action = 4 ActionMute Action = 5 ActionDisable Action = 6 ) func (a Action) Valid() bool { return a >= ActionLog && a <= ActionDisable } // Effective maps v1 unsupported actions (hide) to reject. func (a Action) Effective() Action { if a == ActionHide { return ActionReject } return a } func (a Action) Severity() int { return int(a.Effective()) } func MaxAction(actions ...Action) Action { var best Action for _, a := range actions { e := a.Effective() if e.Severity() > best.Severity() { best = e } } return best }