"use client";

import { useMemo } from "react";
import { Box, IconButton, Tooltip } from "@mui/material";
import DataTableWithAuth from "@/core/components/DataTableWithAuth";
import AssignmentIcon from "@mui/icons-material/Assignment";

const TaskList = () => {
    const columns = useMemo(
        () => [
            {
                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={"generalManagerZaminGov"}
                    table_name={"generalManagerZaminGovList"}
                    enableRowActions
                    positionActionsColumn={"last"}
                    renderRowActions={({ row, table }) => (
                        <Tooltip arrow title="نمایش جزئیات" placement="right">
                            <IconButton color="success" onClick={() => console.log("next part")}>
                                <AssignmentIcon />
                            </IconButton>
                        </Tooltip>
                    )}
                />
            </Box>
        </>
    );
};
export default TaskList;
