import { DataTable } from "react-native-paper";

import { SortableHeader } from "@/components/shared/SortableHeader";
import { TableSortDirection } from "@/constants/tableSortDirectionEnum";

interface LogsTableHeaderProps {
  sortColumn: string | null;
  sortDirection: TableSortDirection;
  onSort: (column: string) => void;
}

export const LogsTableHeader = ({
  sortColumn,
  sortDirection,
  onSort,
}: LogsTableHeaderProps) => {
  return (
    <DataTable.Header>
      <SortableHeader
        title="Name"
        column="name"
        sortColumn={sortColumn}
        sortDirection={sortDirection}
        onSort={onSort}
      />
      <SortableHeader
        title="Email"
        column="email"
        sortColumn={sortColumn}
        sortDirection={sortDirection}
        onSort={onSort}
      />
      <SortableHeader
        title="Time"
        column="lastLoginAt"
        sortColumn={sortColumn}
        sortDirection={sortDirection}
        onSort={onSort}
      />
      <SortableHeader
        title="Login activity"
        column="activity"
        sortColumn={sortColumn}
        sortDirection={sortDirection}
        onSort={onSort}
      />
    </DataTable.Header>
  );
};
