import { useMyAdminOrganizations, OrgAdminOrganization } from "@/user-management/hooks/useOrgAdminOrganizations";
import { Entity } from "../types";

interface UseOrganizationsData {
  organizations: Entity[];
  isLoading: boolean;
}

export const useOrganizationsData = ({
  currentOrgId: _currentOrgId,
}: {
  currentOrgId?: string;
}): UseOrganizationsData => {
  const { organizations: adminOrgs, isLoading } = useMyAdminOrganizations();

  const organizations: Entity[] = adminOrgs.map((item: OrgAdminOrganization) => ({
    id: item.id,
    name: item.name,
  }));

  return { organizations, isLoading };
};
