import type { EventCategory } from '@/services/events' export interface CategoryTreeOption { id: number name: string depth: number } // Defends against a malformed/cyclic parentId chain reaching the client // (shouldn't happen -- event-categories.md's re-parent guard blocks this // server-side -- but a client-side tree builder walking `parentId` // links needs its own bound regardless, since it has no way to verify // the guard actually ran on this data). const MAX_DEPTH = 32 /** * Depth-first flatten of a flat, parentId-linked category list into * actual tree order (a parent immediately followed by its children, * siblings ordered by `sortOrder` then name). Used to render an * indented tree picker (formElements/Input select + option.depth) instead of a plain flat *