"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.pickNode = exports.initMockNode = exports.initNode = void 0;
const index_1 = require("@/constants/index");
const common_1 = require("./common");
/**
 * init node
 * @returns node
 */
const initNode = (component) => {
    var _a;
    return {
        id: (0, common_1.generateStructureId)(),
        label: ((_a = component.category) === null || _a === void 0 ? void 0 : _a.name) || component.label || component.name,
        name: component.name,
        type: index_1.REACT_COMPONENT_TYPE,
        props: {},
        children: [],
        extension: {
            sort: 100,
        },
        version: '',
    };
};
exports.initNode = initNode;
/**
 * init mock node
 * @param node mocked node
 * @returns
 */
const initMockNode = (node) => {
    return {
        id: node.id || (0, common_1.generateStructureId)(),
        name: node.name,
        props: {},
    };
};
exports.initMockNode = initMockNode;
/**
 * pick node
 * @param node
 * @returns
 */
const pickNode = (node) => {
    return {
        id: node.id,
        label: node.label,
        name: node.name,
        props: node.props,
        version: node.version,
        type: node.type,
        children: node.children,
        extension: node.extension,
        directive: node.directive,
    };
};
exports.pickNode = pickNode;
