//
// SPDX-License-Identifier: AGPL-3.0
-import { Tree } from "~/models/tree";
-import { TreeItemStatus } from "~/components/tree/tree";
+import { Tree } from "models/tree";
+import { TreeItemStatus } from 'components/tree/tree';
+export type TreePicker = { [key: string]: Tree<any> };
-export type TreePicker = { [key: string]: Tree<TreePickerNode> };
+export const getTreePicker = <Value = {}>(id: string) => (state: TreePicker): Tree<Value> | undefined => state[id];
-export interface TreePickerNode {
- id: string;
- value: any;
- selected: boolean;
- collapsed: boolean;
- status: TreeItemStatus;
-}
-
-export const createTreePickerNode = (data: { id: string, value: any }) => ({
+export const createTreePickerNode = (data: { nodeId: string, value: any }) => ({
...data,
selected: false,
collapsed: true,