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

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

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

export const AdminTodoTableHeader = ({
  sortColumn,
  sortDirection,
  onSort,
}: AdminTodoTableHeaderProps) => {
  return (
    <DataTable.Header>
      <SortableHeader
        title="Title"
        column="title"
        sortColumn={sortColumn}
        sortDirection={sortDirection}
        onSort={onSort}
      />
      <SortableHeader
        title="Task"
        column="task"
        sortColumn={sortColumn}
        sortDirection={sortDirection}
        onSort={onSort}
      />
      <SortableHeader
        title="Status"
        column="status"
        sortColumn={sortColumn}
        sortDirection={sortDirection}
        onSort={onSort}
        centerAlign
      />
      <SortableHeader
        title="Priority"
        column="priority"
        sortColumn={sortColumn}
        sortDirection={sortDirection}
        onSort={onSort}
        centerAlign
      />
      <SortableHeader
        title="Date Created"
        column="createdAt"
        sortColumn={sortColumn}
        sortDirection={sortDirection}
        onSort={onSort}
        centerAlign
      />
      <DataTable.Title style={{ justifyContent: "center" }}>
        <Text style={{ fontSize: 12, color: "black" }}>Actions</Text>
      </DataTable.Title>
    </DataTable.Header>
  );
};
