// (C) 2021-2026 GoodData Corporation
import { eventGuard } from "./util.js";
export function layoutSectionAdded(ctx, section, index, path, correlationId) {
    return {
        type: "GDC.DASH/EVT.FLUID_LAYOUT.SECTION_ADDED",
        ctx,
        correlationId,
        payload: {
            section,
            index,
            path,
        },
    };
}
/**
 * Tests whether the provided object is an instance of {@link IDashboardLayoutSectionAdded}.
 *
 * @param obj - object to test
 * @beta
 */
export const isDashboardLayoutSectionAdded = eventGuard("GDC.DASH/EVT.FLUID_LAYOUT.SECTION_ADDED");
export function layoutSectionMoved(ctx, section, fromIndex, toIndex, fromPath, toPath, correlationId) {
    return {
        type: "GDC.DASH/EVT.FLUID_LAYOUT.SECTION_MOVED",
        ctx,
        correlationId,
        payload: {
            section,
            fromIndex,
            toIndex,
            fromPath,
            toPath,
        },
    };
}
/**
 * Tests whether the provided object is an instance of {@link IDashboardLayoutSectionMoved}.
 *
 * @param obj - object to test
 * @beta
 */
export const isDashboardLayoutSectionMoved = eventGuard("GDC.DASH/EVT.FLUID_LAYOUT.SECTION_MOVED");
export function layoutSectionRemoved(ctx, section, index, path, eagerRemoval, stashIdentifier, correlationId) {
    return {
        type: "GDC.DASH/EVT.FLUID_LAYOUT.SECTION_REMOVED",
        ctx,
        correlationId,
        payload: {
            section,
            index,
            path,
            eagerRemoval,
            stashIdentifier,
        },
    };
}
/**
 * Tests whether the provided object is an instance of {@link IDashboardLayoutSectionRemoved}.
 *
 * @param obj - object to test
 * @beta
 */
export const isDashboardLayoutSectionRemoved = eventGuard("GDC.DASH/EVT.FLUID_LAYOUT.SECTION_REMOVED");
export function layoutSectionHeaderChanged(ctx, newHeader, sectionIndex, sectionPath, correlationId) {
    return {
        type: "GDC.DASH/EVT.FLUID_LAYOUT.SECTION_HEADER_CHANGED",
        ctx,
        correlationId,
        payload: {
            newHeader,
            sectionIndex,
            sectionPath,
        },
    };
}
export function layoutSectionItemsHeightResized(ctx, sectionIndex, sectionPath, itemIndexes, newHeight, correlationId) {
    return {
        type: "GDC.DASH/EVT.FLUID_LAYOUT.SECTION_ITEMS_HEIGHT_RESIZED",
        ctx,
        correlationId,
        payload: {
            sectionIndex,
            sectionPath,
            itemIndexes,
            newHeight,
        },
    };
}
export function layoutSectionItemWidthResized(ctx, sectionIndex, itemIndex, path, newWidth, correlationId) {
    return {
        type: "GDC.DASH/EVT.FLUID_LAYOUT.SECTION_ITEM_WIDTH_RESIZED",
        ctx,
        correlationId,
        payload: {
            sectionIndex,
            itemIndex,
            path,
            newWidth,
        },
    };
}
/**
 * Tests whether the provided object is an instance of {@link IDashboardLayoutSectionHeaderChanged}.
 *
 * @param obj - object to test
 * @beta
 */
export const isDashboardLayoutSectionHeaderChanged = eventGuard("GDC.DASH/EVT.FLUID_LAYOUT.SECTION_HEADER_CHANGED");
export function layoutSectionItemsAdded(ctx, sectionIndex, startIndex, path, itemsAdded, stashesUsed, correlationId) {
    return {
        type: "GDC.DASH/EVT.FLUID_LAYOUT.ITEMS_ADDED",
        ctx,
        correlationId,
        payload: {
            sectionIndex,
            startIndex,
            path,
            itemsAdded,
            stashesUsed,
        },
    };
}
/**
 * Tests whether the provided object is an instance of {@link IDashboardLayoutSectionItemsAdded}.
 *
 * @param obj - object to test
 * @beta
 */
export const isDashboardLayoutSectionItemsAdded = eventGuard("GDC.DASH/EVT.FLUID_LAYOUT.ITEMS_ADDED");
export function layoutSectionItemReplaced(ctx, sectionIndex, itemIndex, path, items, previousItem, stashIdentifier, correlationId) {
    return {
        type: "GDC.DASH/EVT.FLUID_LAYOUT.ITEM_REPLACED",
        ctx,
        correlationId,
        payload: {
            sectionIndex,
            itemIndex,
            path,
            items,
            previousItem,
            stashIdentifier,
        },
    };
}
/**
 * Tests whether the provided object is an instance of {@link IDashboardLayoutSectionItemReplaced}.
 *
 * @param obj - object to test
 * @beta
 */
export const isDashboardLayoutSectionItemReplaced = eventGuard("GDC.DASH/EVT.FLUID_LAYOUT.ITEM_REPLACED");
export function layoutSectionItemMoved(ctx, item, fromSectionIndex, toSectionIndex, fromIndex, toIndex, fromPath, toPath, originalSectionRemoved, correlationId) {
    return {
        type: "GDC.DASH/EVT.FLUID_LAYOUT.ITEM_MOVED",
        ctx,
        correlationId,
        payload: {
            item,
            fromSectionIndex,
            toSectionIndex,
            fromIndex,
            toIndex,
            fromPath,
            toPath,
            originalSectionRemoved,
        },
    };
}
/**
 * Tests whether the provided object is an instance of {@link IDashboardLayoutSectionItemMoved}.
 *
 * @param obj - object to test
 * @beta
 */
export const isDashboardLayoutSectionItemMoved = eventGuard("GDC.DASH/EVT.FLUID_LAYOUT.ITEM_MOVED");
export function layoutSectionItemMovedToNewSection(ctx, item, fromSectionIndex, toSectionIndex, fromIndex, toIndex, fromPath, toPath, originalSectionRemoved, correlationId) {
    return {
        type: "GDC.DASH/EVT.FLUID_LAYOUT.ITEM_MOVED_TO_NEW_SECTION",
        ctx,
        correlationId,
        payload: {
            item,
            fromSectionIndex,
            toSectionIndex,
            fromIndex,
            toIndex,
            fromPath,
            toPath,
            originalSectionRemoved,
        },
    };
}
/**
 * Tests whether the provided object is an instance of {@link IDashboardLayoutSectionItemMovedToNewSection}.
 *
 * @param obj - object to test
 * @beta
 */
export const isDashboardLayoutSectionItemMovedToNewSection = eventGuard("GDC.DASH/EVT.FLUID_LAYOUT.ITEM_MOVED_TO_NEW_SECTION");
export function layoutSectionItemRemoved(ctx, item, itemIndex, itemPath, section, stashIdentifier, correlationId) {
    return {
        type: "GDC.DASH/EVT.FLUID_LAYOUT.ITEM_REMOVED",
        ctx,
        correlationId,
        payload: {
            item,
            itemIndex,
            itemPath,
            section,
            stashIdentifier,
        },
    };
}
/**
 * Tests whether the provided object is an instance of {@link IDashboardLayoutSectionItemRemoved}.
 *
 * @param obj - object to test
 * @beta
 */
export const isDashboardLayoutSectionItemRemoved = eventGuard("GDC.DASH/EVT.FLUID_LAYOUT.ITEM_REMOVED");
export function layoutChanged(ctx, layout, correlationId) {
    return {
        type: "GDC.DASH/EVT.FLUID_LAYOUT.LAYOUT_CHANGED",
        ctx,
        correlationId,
        payload: {
            layout,
        },
    };
}
/**
 * Tests whether the provided object is an instance of {@link IDashboardLayoutChanged}.
 *
 * @param obj - object to test
 * @beta
 */
export const isDashboardLayoutChanged = eventGuard("GDC.DASH/EVT.FLUID_LAYOUT.LAYOUT_CHANGED");
export function screenSizeChanged(ctx, screenSize, correlationId) {
    return {
        type: "GDC.DASH/EVT.FLUID_LAYOUT.SCREEN_SIZE_CHANGED",
        ctx,
        correlationId,
        payload: {
            screenSize,
        },
    };
}
/**
 * Tests whether the provided object is an instance of {@link IScreenSizeChanged}.
 *
 * @param obj - object to test
 * @beta
 */
export const isScreenSizeChanged = eventGuard("GDC.DASH/EVT.FLUID_LAYOUT.SCREEN_SIZE_CHANGED");
export function layoutSectionHeadersToggled(ctx, layoutPath, areSectionHeadersEnabled, correlationId) {
    return {
        type: "GDC.DASH/EVT.FLEXIBLE_LAYOUT.LAYOUT_SECTION_HEADERS_TOGGLED",
        ctx,
        correlationId,
        payload: {
            layoutPath,
            areSectionHeadersEnabled,
        },
    };
}
/**
 * Tests whether the provided object is an instance of {@link ILayoutSectionHeadersToggled}.
 *
 * @param obj - object to test
 * @beta
 */
export const isLayoutSectionHeadersToggled = eventGuard("GDC.DASH/EVT.FLEXIBLE_LAYOUT.LAYOUT_SECTION_HEADERS_TOGGLED");
export function layoutDirectionChanged(ctx, layoutPath, direction, correlationId) {
    return {
        type: "GDC.DASH/EVT.FLEXIBLE_LAYOUT.LAYOUT_DIRECTION_CHANGED",
        ctx,
        correlationId,
        payload: {
            layoutPath,
            direction,
        },
    };
}
/**
 * Tests whether the provided object is an instance of {@link ILayoutDirectionChanged}.
 *
 * @param obj - object to test
 * @beta
 */
export const isLayoutDirectionChanged = eventGuard("GDC.DASH/EVT.FLEXIBLE_LAYOUT.LAYOUT_DIRECTION_CHANGED");
