import React from 'react'
import { useTranslation } from 'react-i18next';
import ColumnsImage from '../../../Components/Columns/ColumnsImage';
import { mapTranslatedProperties } from '../../../utils/language/mapTranslatedProperties';
export default function useTableColumns() {
    const [t] = useTranslation();
    const language = localStorage.getItem("language") ?? "en"

    return  [
        {   
            name: t("id"),
            sortable: true, 
            center: true,
            cell:(row) => row.id
            
        },
        {
            name: `${t('name')}`,
            sortable: true,
            center: true,
            cell:(row) => row.name[language]
        },

        {
            name: `${t("image")}`,
            sortable: false,
            center: true,
            cell: (row) => {
                const imgSource = row?.main_photo
                return (
                   <ColumnsImage 
                    src={imgSource}

                   />
                );
            },
        },
      

        {
            name: t("quantity"),
            sortable: true,
            center: true,
            cell:(row)=>row?.quantity
            
        },

        {
            name: t("price"),
            sortable: true,
            center: true,
            cell:(row)=>row?.price


        },


    ]
}
