import { useMemo } from 'react';
export const useLogic = ({ row, cell, emptyCellValue, startAdornment, }) => {
    const { format, field, label, hideTitleOnMobile } = cell;
    const isValidValue = (value) => {
        return Boolean(value) || value === 0;
    };
    const formattedValue = useMemo(() => {
        if (format && isValidValue(format(row))) {
            return format(row);
        }
        if (field && isValidValue(row[field])) {
            return row[field];
        }
        return emptyCellValue;
    }, [field, format, row, emptyCellValue]);
    const hasStartAdornment = Boolean(startAdornment);
    const isActionColumn = cell.field === 'actions';
    return {
        formattedValue,
        hasStartAdornment,
        isActionColumn,
        label,
        hideTitleOnMobile,
    };
};
