import { useMemo } from "react";
import { useGetMembers } from "../api/use-get-members";

interface UseMembersForMentionsProps {
  workspaceId: string;
}

export const useMembersForMentions = ({ workspaceId }: UseMembersForMentionsProps) => {
  const { data: membersData, isLoading } = useGetMembers({ workspaceId });

  const mentionableMembers = useMemo(() => {
    if (!membersData?.documents) return [];

    return membersData.documents.map((member: any) => ({
      id: member.userId,
      name: member.name || member.email,
      email: member.email,
      image: member.imageUrl,
    }));
  }, [membersData?.documents]);

  return {
    members: mentionableMembers,
    isLoading,
  };
}; 