'use client';

import type { ColumnDef } from '@tanstack/react-table';

import { DataTable } from '@/components/data-table';
import type { UploadListItem } from '@/types';

interface UploadTableProps {
  columns: ColumnDef<UploadListItem>[];
  uploads: UploadListItem[];
  isLoading: boolean;
  skip: number;
  limit: number;
  total: number;
  onUploadClick: (upload: UploadListItem) => void;
  onPageChange: (skip: number) => void;
  onLimitChange: (limit: number) => void;
}

export function UploadTable({
  columns,
  uploads,
  isLoading,
  skip,
  limit,
  total,
  onUploadClick,
  onPageChange,
  onLimitChange,
}: UploadTableProps) {
  return (
    <DataTable
      data={uploads}
      columns={columns}
      isLoading={isLoading}
      emptyTitle="No uploads found"
      emptyDescription="Upload your first road inspection video."
      onRowClick={onUploadClick}
      pagination={{
        skip,
        limit,
        totalItems: total,
        onPageChange,
        onLimitChange,
      }}
      enableColumnControls={false}
      minColumnSize={120}
    />
  );
}
