import isDeepEqual from 'lodash/isEqual';
import { isPivotLayoutModel } from './isPivotLayoutModel';
import { normalizePivotLayoutModel, normalizeTableLayoutModel } from './normalizeLayoutModel';
export function isTableLayoutEqual(l1, l2) {
    l1 = normalizeTableLayoutModel(l1);
    l2 = normalizeTableLayoutModel(l2);
    return isDeepEqual(l1, l2);
}
export function isPivotLayoutEqual(l1, l2) {
    l1 = normalizePivotLayoutModel(l1);
    l2 = normalizePivotLayoutModel(l2);
    return isDeepEqual(l1, l2);
}
export function isLayoutEqual(l1, l2) {
    if (isPivotLayoutModel(l1) != isPivotLayoutModel(l2)) {
        return false;
    }
    if (isPivotLayoutModel(l1) && isPivotLayoutModel(l2)) {
        return isPivotLayoutEqual(l1, l2);
    }
    if (!isPivotLayoutModel(l1) && !isPivotLayoutModel(l2)) {
        return isTableLayoutEqual(l1, l2);
    }
    return false;
}
