import type { Group, Space } from "@rakazo/contracts"; export function isHauptthreadGroup(group: Pick): boolean { return group.name === "Hauptthread" || group.name === "Team Chat"; } /** Project-scoped group chats in a space (excludes Hauptthread). */ export function projectGroupChatsInSpace( groups: readonly Pick[], spaceId: string, ): readonly Pick[] { return groups.filter((group) => group.spaceId === spaceId && !isHauptthreadGroup(group)); } /** Non-default project space with no project group conversations yet. */ export function isEmptyProjectSpace( spaceId: string | null | undefined, spaces: readonly Pick[], groups: readonly Pick[], homeSpaceId: string | undefined, ): boolean { if (!spaceId || !homeSpaceId || spaceId === homeSpaceId) return false; const space = spaces.find((item) => item.id === spaceId); if (!space || space.isDefault) return false; return projectGroupChatsInSpace(groups, spaceId).length === 0; }