from mw_helper import ensure_iterable

from ._OrderCondition import OrderCondition
from production.model import ProductionOrder


class CustomPropertyCondition(OrderCondition):
    def __init__(self, properties):
        self.properties = ensure_iterable(properties)

    def evaluate(self, order):
        # type: (ProductionOrder) -> bool

        for prop in self.properties:
            if prop in order.properties:
                return True

        return False
