import { type FC } from "react";
import TaskDetailUsersList from "./TaskDetailUsersList";
import type { TaskUser } from "./types";

type Props = {
  users: TaskUser[];
  selectedIds: Set<string>;
  onToggle: (id: string) => void;
  isLoading?: boolean;
  isSubmitting?: boolean;
  hasNextPage?: boolean;
  isFetchingNextPage?: boolean;
  onLoadMore?: () => void;
  search: string;
  onSearchChange: (value: string) => void;
};

const TaskDetailUsersPopover: FC<Props> = ({
  users,
  selectedIds,
  onToggle,
  isLoading,
  isSubmitting,
  hasNextPage,
  isFetchingNextPage,
  onLoadMore,
  search,
  onSearchChange,
}) => {
  return (
    <TaskDetailUsersList
      users={users}
      selectedIds={selectedIds}
      onToggle={onToggle}
      isLoading={isLoading}
      isSubmitting={isSubmitting}
      hasNextPage={hasNextPage}
      isFetchingNextPage={isFetchingNextPage}
      onLoadMore={onLoadMore}
      search={search}
      onSearchChange={onSearchChange}
    />
  );
};

export default TaskDetailUsersPopover;
