/**
 * @description This function converts SelectorCategoryData[] SuggestData
 */
const convertToTreeItem = (item) => {
    var _a;
    return ({
        caption: item.name,
        id: item.id,
        items: ((_a = item.items) !== null && _a !== void 0 ? _a : []).map(convertToTreeItem),
        lazy: item.hasChildren && (item.items == null || item.items.length === 0),
        leaf: item.hasChildren === false,
        startImgSrc: item.icon
    });
};
/**
 * @description This function converts ReferenceData[] data to TreeItemData[]
 */
export const convertReferenceDataToTreeViewData = (referenceData) => {
    const treeData = [];
    if (!referenceData) {
        return treeData;
    }
    referenceData.forEach(item => {
        treeData.push(convertToTreeItem(item));
    });
    return treeData;
};
export const mapObjectDataToComboBoxItemModel = (options) => {
    return options.map(option => {
        var _a;
        return {
            value: option.id,
            caption: option.name,
            startImgSrc: (_a = option.icon) !== null && _a !== void 0 ? _a : ""
        };
    });
};
export const mapSelectorCategoryDataToComboBoxModel = (categoryData) => {
    return categoryData.map((category) => {
        const mappedGroup = {
            value: category.name,
            caption: category.name,
            expandable: true,
            expanded: true,
            items: category.items.map((item) => ({
                value: item.id,
                caption: item.description,
                startImgSrc: item.icon
            }))
        };
        return mappedGroup;
    });
};
//# sourceMappingURL=helpers.js.map
