"""
Implementation of an OmniGraph node that contains attributes with the allowedTokens metadata
"""
import omni.graph.tools.ogn as ogn


class OgnTestAllowedTokens:
    @staticmethod
    def compute(db):
        allowed_simple = db.attributes.inputs.simpleTokens.get_metadata(ogn.MetadataKeys.ALLOWED_TOKENS).split(",")
        allowed_special = db.attributes.inputs.specialTokens.get_metadata(ogn.MetadataKeys.ALLOWED_TOKENS).split(",")

        assert db.tokens.red in allowed_simple
        assert db.tokens.green in allowed_simple
        assert db.tokens.blue in allowed_simple

        assert db.tokens.lt in allowed_special
        assert db.tokens.gt in allowed_special

        db.outputs.combinedTokens = f"{db.inputs.simpleTokens}{db.inputs.specialTokens}"

        return True
