"""
This node's compute checks that its input attrib is properly enabled.
"""
import omni.graph.core as og


class OgnExecInputEnabledTest:
    @staticmethod
    def compute(db) -> bool:

        if (
            db.inputs.execInA == og.ExecutionAttributeState.ENABLED
            and db.inputs.execInB == og.ExecutionAttributeState.ENABLED
        ):
            db.log_warning("Unexpected execution with both execution inputs enabled")
            return False
        if db.inputs.execInA == og.ExecutionAttributeState.ENABLED:
            db.outputs.execOutA = og.ExecutionAttributeState.ENABLED
            return True
        if db.inputs.execInB == og.ExecutionAttributeState.ENABLED:
            db.outputs.execOutB = og.ExecutionAttributeState.ENABLED
            return True

        db.log_warning("Unexpected execution with no execution input enabled")
        db.outputs.execOut = og.ExecutionAttributeState.DISABLED
        return False
