"use client";

import { useMemo } from "react";
import { Box } from "@mui/material";
import DataTableWithAuth from "@/core/components/DataTableWithAuth";
import RowActions from "./RowActions";

const TaskList = () => {
    const columns = useMemo(
        () => [
            {
                accessorKey: "id",
                header: "کد یکتا",
                id: "id",
                enableColumnFilter: false,
                datatype: "text",
                filterFn: "notEquals",
            },
            {
                accessorKey: "aplication_number",
                header: "شماره درخواست",
                id: "aplication_number",
                enableColumnFilter: false,
                datatype: "text",
                filterFn: "notEquals",
            },
            {
                accessorKey: "application_date",
                header: "تاریخ درخواست",
                id: "application_date",
                enableColumnFilter: false,
                datatype: "text",
                filterFn: "equals",
            },
            {
                accessorKey: "province",
                header: "استان",
                id: "province",
                enableColumnFilter: false,
                datatype: "text",
                filterFn: "equals",
            },
            {
                accessorKey: "city",
                header: "شهر",
                id: "city",
                enableColumnFilter: false,
                datatype: "text",
                filterFn: "equals",
            },
            {
                accessorKey: "county",
                header: "بخش",
                id: "county",
                enableColumnFilter: false,
                datatype: "text",
                filterFn: "equals",
            },
            {
                accessorKey: "village",
                header: "روستا",
                id: "village",
                enableColumnFilter: false,
                datatype: "text",
                filterFn: "equals",
            },
            {
                accessorKey: "land_area",
                header: "مساحت زمین",
                id: "land_area",
                enableColumnFilter: false,
                datatype: "text",
                filterFn: "equals",
            },
            {
                accessorKey: "design_area",
                header: "مساحت طرح",
                id: "design_area",
                enableColumnFilter: false,
                datatype: "text",
                filterFn: "equals",
            },
            {
                accessorKey: "organization",
                header: "سازمان",
                id: "organization",
                enableColumnFilter: false,
                datatype: "text",
                filterFn: "equals",
            },
            {
                accessorKey: "design_group",
                header: "گروه طرح",
                id: "design_group",
                enableColumnFilter: false,
                datatype: "text",
                filterFn: "equals",
            },
            {
                accessorKey: "design_title",
                header: "عنوان طرح",
                id: "design_title",
                enableColumnFilter: false,
                datatype: "text",
                filterFn: "equals",
            },
        ],
        []
    );

    return (
        <>
            <Box sx={{ p: 1, border: 1, borderColor: "divider", borderRadius: 1 }}>
                <DataTableWithAuth
                    table_title={"لیست استعلام ها"}
                    need_filter={false}
                    columns={columns}
                    table_url={"/v3/api/fake-data"}
                    page_name={"provinceAdminZaminGov"}
                    table_name={"provinceAdminZaminGovList"}
                    enableRowActions
                    positionActionsColumn={"last"}
                    renderRowActions={({ row }) => <RowActions row={row} />}
                />
            </Box>
        </>
    );
};
export default TaskList;
