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

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

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

export const AdminTableHeader = ({
  sortColumn,
  sortDirection,
  onSort,
}: AdminTableHeaderProps) => {
  return (
    <DataTable.Header>
      <SortableHeader
        title="Name"
        column="firstName"
        sortColumn={sortColumn}
        sortDirection={sortDirection}
        onSort={onSort}
      />
      <SortableHeader
        title="Email"
        column="email"
        sortColumn={sortColumn}
        sortDirection={sortDirection}
        onSort={onSort}
      />
      <SortableHeader
        title="Role"
        column="role"
        sortColumn={sortColumn}
        sortDirection={sortDirection}
        onSort={onSort}
        centerAlign
      />
      <DataTable.Title style={{ justifyContent: "center" }}>
        <Text style={{ fontSize: 12 }}>Actions</Text>
      </DataTable.Title>
    </DataTable.Header>
  );
};
