import { GroupedData, TargetItem } from "@/types/user";

export function transformData(data: GroupedData): TargetItem[] {
    const result: TargetItem[] = [];

    for (const category in data) {
        const items = data[category];

        // 构建该类别的 children
        const children = items.map(item => ({
            name: item.display_name,
            value: item.id
        }));

        result.push({
            name: category,
            children,
        });
    }

    return result;
}