public static Rule fromNode(Node node) {
        ObjectNode objectNode = node.expectObjectNode();

        Builder builder = new Builder(node);
        objectNode.getStringMember(DOCUMENTATION, builder::description);
        builder.conditions(objectNode.expectArrayMember(CONDITIONS).getElementsAs(Condition::fromNode));

        String type = objectNode.expectStringMember(TYPE).getValue();
        switch (type) {
            case ENDPOINT:
                return builder.endpoint(Endpoint.fromNode(objectNode.expectMember(ENDPOINT)));
            case ERROR:
                return builder.error(objectNode.expectMember(ERROR));
            case TREE:
                return builder.treeRule(objectNode.expectArrayMember(RULES).getElementsAs(Rule::fromNode));
            default:
                throw new IllegalStateException("Unexpected rule type: " + type);
        }
    }
Creates a {@link Rule} instance from the given Node information.

@param node the node to deserialize.
@return the created Rule.
smithy-rules-engine/src/main/java/software/amazon/smithy/rulesengine/language/syntax/rule/Rule.java