'use client'
import DataTable from "@/core/components/DataTable";
import {useMemo} from "react";

function HomeComponent() {
    const columns = useMemo(
        () => [
            {
                accessorKey: 'fullname',
                header: 'نام کامل',
                id: "fullname",
                columns: [
                    {
                        accessorKey: 'name.firstName',
                        header: 'نام',
                        id: "firstName",
                        enableColumnFilter: true,
                        datatype: "text",
                        filterFn: "contains",
                        inputType: "textField",
                        enableClickToCopy: true,
                        columnFilterModeOptions: [
                            "equals",
                            "notEquals",
                            "contains"
                        ],
                    },
                    {
                        accessorKey: 'name.lastName',
                        header: 'نام خانوادگی',
                        id: "lastName",
                        enableColumnFilter: true,
                        datatype: "text",
                        filterFn: "equals",
                        inputType: "textField",
                        columnFilterModeOptions: [
                            "equals",
                            "notEquals",
                            "contains"
                        ],
                    },
                ],
            },
            {
                accessorKey: 'address',
                header: 'آدرس',
                id: "address",
                enableColumnFilter: true,
                datatype: "text",
                filterFn: "notEquals",
                inputType: "textField",
                columnFilterModeOptions: [
                    "equals",
                    "notEquals",
                    "contains"
                ],
            },
            {
                accessorKey: 'city',
                header: 'شهر',
                id: "city",
                enableColumnFilter: true,
                datatype: "text",
                filterFn: "equals",
                inputType: "textField",
                columnFilterModeOptions: [
                    "equals",
                    "notEquals",
                    "contains",
                    "lessThan",
                    "greaterThan",
                    "fuzzy"
                ],

            },
            {
                accessorKey: 'state',
                header: 'وضعیت',
                id: "state",
                enableColumnFilter: true,
                datatype: "text",
                filterFn: "contains",
                inputType: "textField",
                columnFilterModeOptions: [
                    "equals",
                    "notEquals",
                    "contains"
                ],
            },
            {
                accessorKey: 'price',
                header: 'محدوده',
                id: "price",
                enableColumnFilter: true,
                datatype: "nemeric",
                filterFn: "between",
                inputType: "betweenNum",
            },
            {
                accessorKey: 'updated_at',
                header: 'تاریخ بروزرسانی',
                id: "updated_at",
                enableColumnFilter: true,
                datatype: "date",
                filterFn: "between",
                inputType: "betweenDate",
            },
            {
                accessorKey: 'company',
                header: 'نام شرکت',
                id: "company",
                enableColumnFilter: true,
                datatype: "text",
                filterFn: "equals",
                inputType: "select2",
            },
            {
                accessorKey: 'area',
                header: 'منطقه',
                id: "area",
                enableColumnFilter: true,
                datatype: "text",
                filterFn: "equals",
                inputType: "select",
            },
        ],
        [],
    );

    return (
        <>
            <DataTable columns={columns} userId={0} pageName={'testPage'} tableName={'testTable'}/>
        </>

    );
}

export default HomeComponent;
