'use client';

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

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

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

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