import { View } from "react-native";

import { TableControls } from "@/components/shared/TableControls";

interface LogsTableControlsProps {
  searchQuery: string;
  menuVisible: boolean;
  menuAnchor: { x: number; y: number };
  onSearch: (query: string) => void;
  onMenuDismiss: () => void;
  onItemsPerPageChange: (value: number) => void;
  itemsPerPage?: number;
  itemsPerPageMenuOptions?: number[];
}

export const LogsTableControls = ({
  searchQuery,
  menuVisible,
  menuAnchor,
  onSearch,
  onMenuDismiss,
  onItemsPerPageChange,
  itemsPerPage = 25,
  itemsPerPageMenuOptions,
}: LogsTableControlsProps) => {
  return (
    <View>
      <TableControls
        searchQuery={searchQuery}
        menuVisible={menuVisible}
        menuAnchor={menuAnchor}
        searchPlaceholder="Search logs"
        onSearch={onSearch}
        onMenuDismiss={onMenuDismiss}
        onItemsPerPageChange={onItemsPerPageChange}
        itemsPerPage={itemsPerPage}
        itemsPerPageMenuOptions={itemsPerPageMenuOptions || [25, 50, 100]}
      />
    </View>
  );
};
