"""
NOTE: DEPRECATED AS OF 1.26.0 IN FAVOUR OF INDIVIDAL BOOLEAN OP NODES
This is the implementation of the OGN node defined in OgnBooleanExpr.ogn
"""


class OgnBooleanExpr:
    """
    Boolean AND of two inputs
    """

    @staticmethod
    def compute(db) -> bool:
        """Compute the outputs from the current input"""
        # convert to numpy bool arrays
        a = db.inputs.a
        b = db.inputs.b
        op = db.inputs.operator.lower()

        if not op:
            return False

        if op == "and":
            result = a and b
        elif op == "or":
            result = a or b
        elif op == "nand":
            result = not (a and b)
        elif op == "nor":
            result = not (a or b)
        elif op in ["xor", "!="]:
            result = a != b
        elif op in ["xnor", "=="]:
            result = a == b
        else:
            return False

        db.outputs.result = result
        return True
