package {{ package_name }}

{% for imp in imports %}
import {{ imp }}
{% endfor %}

rule "{{ rule.name }}"
{% if rule.salience is not none %}
    salience {{ rule.salience }}
{% endif %}
{% if rule.no_loop %}
    no-loop true
{% endif %}
when
    $rel : Relation(
        relationType == "{{ rule.relation_type }}",
        $srcId : sourceId,
        $dstId : targetId
    )

    $src : Component(
        id == $srcId,
        type == "{{ rule.source_type }}"
    )

    $dst : Component(
        id == $dstId,
        type == "{{ rule.target_type }}"
    )
then
    RuleActions.createActivity(
        "{{ rule.activity.kind }}",
        $dst,
        "{{ rule.activity.value }}"
    );
end
