/** Constant for the utility column ID used in selection/expansion columns */
const UTILITY_COLUMN_ID = 'utility';
/** Width value for the utility column (1px + nowrap = shrink-to-content) */
const UTILITY_COLUMN_WIDTH = 1;
/** Tailwind JIT-safe alignment class mapping */
const alignmentClasses = {
    left: 'text-left',
    center: 'text-center',
    right: 'text-right',
};
/**
 * Generate a stable row identifier for React keys and row IDs
 * @param row - The data row object
 * @param index - The row index as fallback
 * @param rowKey - Optional key extractor function or property name
 * @returns A stable string identifier for the row
 */
function getRowId(row, index, rowKey) {
    if (!rowKey) {
        // Fallback to index if no rowKey is provided (maintains backward compatibility)
        return `row-${index}`;
    }
    if (typeof rowKey === 'function') {
        // Use the function to extract the key
        const key = rowKey(row, index);
        return `row-${key}`;
    }
    // Use the property name to extract the key
    const key = row[rowKey];
    if (key === undefined || key === null) {
        // Fallback to index if the property doesn't exist or is null/undefined
        if (process.env.NODE_ENV !== 'production') {
            console.warn(`[Table]: Row key property "${String(rowKey)}" is undefined or null for row at index ${index}. Falling back to index-based key.`);
        }
        return `row-${index}`;
    }
    return `row-${key}`;
}

export { UTILITY_COLUMN_ID, UTILITY_COLUMN_WIDTH, alignmentClasses, getRowId };
