export function validateNode(node) {
    const errors = [];
    const ports = new Set();
    if (node.id.length === 0) {
        errors.push("Node id is required");
    }
    for (const port of node.ports) {
        if (port.id.length === 0) {
            errors.push(`Port id is required on node ${node.id}`);
        }
        if (ports.has(port.id)) {
            errors.push(`Duplicate port id on node ${node.id}: ${port.id}`);
        }
        ports.add(port.id);
        if (port.direction !== "input" && port.direction !== "output") {
            errors.push(`Invalid port direction on node ${node.id}.${port.id}`);
        }
        if (!["flow", "number", "boolean", "string", "object", "any"].includes(port.type)) {
            errors.push(`Invalid port type on node ${node.id}.${port.id}`);
        }
    }
    return errors;
}
//# sourceMappingURL=VisualNode.js.map