func NewOrAggregator(name string) TemplateOption {
	return DecisionAggregator(
		name,
		&OrAggregator{
			name:   name,
			defDec: model.NewBoolDecisionValue(name, types.False),
		},
	)
}
NewOrAggregator returns an OrAggregator which accumulates values into a boolean decision.
package runtime
import (
	"github.com/google/cel-policy-templates-go/policy/model"
	"github.com/google/cel-go/cel"
	"github.com/google/cel-go/common/types"
	"github.com/google/cel-go/interpreter"
)
type Aggregator interface {
	DefaultDecision() model.DecisionValue
	Aggregate(cel.Program,
		interpreter.Activation,
		model.DecisionValue,
		model.Rule) (model.DecisionValue, error)
}
func NewAndAggregator(name string) TemplateOption {
	return DecisionAggregator(
		name,
		&AndAggregator{
			name:   name,
			defDec: model.NewBoolDecisionValue(name, types.True),
		},
	)
}
type AndAggregator struct {
	name   string
	defDec *model.BoolDecisionValue
}
func (and *AndAggregator) DefaultDecision() model.DecisionValue {
	return model.NewBoolDecisionValue(and.name, types.True)
}
func (and *AndAggregator) Aggregate(prg cel.Program, vars interpreter.Activation,
	prev model.DecisionValue, rule model.Rule) (model.DecisionValue, error) {
	val, det, _ := prg.Eval(vars)
	prevBool := prev.(*model.BoolDecisionValue)
	decVal := prevBool.And(val)
	if decVal.Value() == types.False {
		decVal.Finalize(det, rule)
	}
	return decVal, nil
}
func NewCollectAggregator(name string) TemplateOption {
	return DecisionAggregator(
		name,
		&CollectAggregator{
			name:   name,
			defDec: model.NewListDecisionValue(name),
		},
	)
}
type CollectAggregator struct {
	name   string
	defDec *model.ListDecisionValue
}
func (col *CollectAggregator) DefaultDecision() model.DecisionValue {
	return col.defDec
}
func (col *CollectAggregator) Aggregate(prg cel.Program, vars interpreter.Activation,
	prev model.DecisionValue, rule model.Rule) (model.DecisionValue, error) {
	val, det, err := prg.Eval(vars)
	if err != nil {
		return nil, err
	}
	var prevList *model.ListDecisionValue
	if prev != col.defDec {
		prevList = prev.(*model.ListDecisionValue)
	} else {
		prevList = model.NewListDecisionValue(col.name)
	}
	prevList.Append(val, det, rule)
	return prevList, nil
}