package org.kie.integrationtest.spring;

import java.util.Set;

rule "consignment"
  when
    $errors: Set()
    $order: Order(type.equals(OrderType.CONSIGNMENT) && buyer.equals(seller))
  then
    $errors.add("A party may not consign to itself.");
end

rule "sale"
  when
    $errors: Set()
    $order: Order(type.equals(OrderType.SALE) && buyer.equals(seller))
  then
    $errors.add("A party may not sell to itself.");
end

rule "transfer"
  when
    $errors: Set()
    $order: Order(type.equals(OrderType.TRANSFER) && !buyer.equals(seller))
  then
    $errors.add("A party may only transfer to itself.");
end
