/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.apache.nifi.rules.engine;

import org.apache.nifi.annotation.documentation.CapabilityDescription;
import org.apache.nifi.annotation.documentation.Tags;
import org.apache.nifi.controller.ControllerService;
import org.apache.nifi.rules.Action;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * A Controller Service that is responsible for executing a rules engine against provided facts.  The subsequent
 * actions can be executed either by the rules engine or a list of {@link Action} can be returned and interrogated/executed by
 * the caller.
 * </p>
 * </p>
 */
@Tags({"rules", "rules-engine","facts","actions"})
@CapabilityDescription("Specifies a Controller Service which hosts a rules engine, that can be used to determine actions that should be performed given provided facts.")
public interface RulesEngineService extends ControllerService {

    /**
     * Returns the list of Actions that should be triggered as determined by the rules engine for the the given facts.
     * Action in this case have not been executed by the engine.
     * @param facts a Map of key and facts values, as objects, that should be evaluated by the rules engine
     * @return a List of Actions that should be triggered
     */
    List<Action> fireRules(Map<String, Object> facts);

}
