'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",
                        enableClickToCopy: true,
                        columnFilterModeOptions: [
                            "equals",
                            "notEquals",
                            "contains"
                        ],
                    },
                    {
                        accessorKey: 'name.lastName',
                        header: 'نام خانوادگی',
                        id: "lastName",
                        enableColumnFilter: true,
                        datatype: "text",
                        filterFn: "equals",
                        columnFilterModeOptions: [
                            "equals",
                            "notEquals",
                            "contains"
                        ],
                    },
                ],
            },
            {
                accessorKey: 'address',
                header: 'آدرس',
                id: "address",
                enableColumnFilter: true,
                datatype: "text",
                filterFn: "notEquals",
                columnFilterModeOptions: [
                    "equals",
                    "notEquals",
                    "contains"
                ],
            },
            {
                accessorKey: 'city',
                header: 'شهر',
                id: "city",
                enableColumnFilter: true,
                datatype: "text",
                filterFn: "equals",
                columnFilterModeOptions: [
                    "equals",
                    "notEquals",
                    "contains",
                    "lessThan",
                    "greaterThan",
                    "fuzzy"
                ],
            },
            {
                accessorKey: 'state',
                header: 'وضعیت',
                id: "state",
                enableColumnFilter: true,
                datatype: "text",
                filterFn: "contains",
                columnFilterModeOptions: [
                    "equals",
                    "notEquals",
                    "contains"
                ],
            },
            {
                accessorKey: 'price',
                header: 'محدوده',
                id: "price",
                enableColumnFilter: true,
                datatype: "numeric",
                filterFn: "equals",
                columnFilterModeOptions: [
                    "equals",
                    "notEquals",
                ],
            },
            {
                accessorKey: 'created_at',
                header: 'تاریخ ساخت',
                id: "created_at",
                enableColumnFilter: true,
                datatype: "date",
                filterFn: "between",
            },
            {
                accessorKey: 'updated_at',
                header: 'تاریخ بروزرسانی',
                id: "updated_at",
                enableColumnFilter: true,
                datatype: "date",
                filterFn: "equals",
            },
            {
                accessorKey: 'company',
                header: 'نام شرکت',
                id: "company",
                enableColumnFilter: true,
                datatype: "numeric",
                filterFn: "equals",
                columnSelectOption: [
                    {value: 1, label: "وایتل"},
                    {value: 2, label: "اسنپ"},
                    {value: 3, label: "تپسی"}
                ],
            },
            {
                accessorKey: 'area',
                header: 'منطقه',
                id: "area",
                enableColumnFilter: true,
                datatype: "array",
                filterFn: "equals",
                columnSelectOption: [
                    {value: 1, label: "وایتل"},
                    {value: 2, label: "اسنپ"},
                    {value: 3, label: "تپسی"}
                ],
            },
        ],
        [],
    );

    return (
        <>
            <DataTable columns={columns} table_url={"api"} user_id={0} page_name={'testPage'} table_name={'testTable'}/>
        </>

    );
}

export default HomeComponent;
