// (C) 2025-2026 GoodData Corporation
/**
 * Creates the DashboardTabSwitched event.
 *
 * @param ctx - dashboard context
 * @param previousTabId - identifier of the previously active tab
 * @param newTabId - identifier of the newly active tab
 * @param correlationId - correlation id to use for this event
 * @param source - what triggered the switch; omit for a regular user-initiated tab switch.
 *  See {@link DashboardTabSwitchSource}.
 * @returns dashboard tab switched event
 *
 * @alpha
 */
export function dashboardTabSwitched(ctx, previousTabId, newTabId, correlationId, source) {
    return {
        type: "GDC.DASH/EVT.TAB.SWITCHED",
        ctx,
        correlationId,
        payload: {
            previousTabId,
            newTabId,
            source,
        },
    };
}
/**
 * Type guard that checks if an event is a DashboardTabSwitched event.
 *
 * @param event - event to check
 * @returns true if the event is a DashboardTabSwitched event
 *
 * @alpha
 */
export const isDashboardTabSwitched = (event) => event.type === "GDC.DASH/EVT.TAB.SWITCHED";
/**
 * Creates the DashboardTabRepositioned event.
 *
 * @param ctx - dashboard context
 * @param oldIndex - old index of the tab before the reposition
 * @param newIndex - new index of the tab after the reposition
 * @param correlationId - correlation id to use for this event
 * @returns dashboard tab repositioned event
 *
 * @alpha
 */
export function dashboardTabRepositioned(ctx, oldIndex, newIndex, correlationId) {
    return {
        type: "GDC.DASH/EVT.TAB.REPOSITIONED",
        ctx,
        correlationId,
        payload: {
            oldIndex,
            newIndex,
        },
    };
}
/**
 * Type guard that checks if an event is a DashboardTabRepositioned event.
 *
 * @param event - event to check
 * @returns true if the event is a DashboardTabRepositioned event
 *
 * @alpha
 */
export const isDashboardTabRepositioned = (event) => event.type === "GDC.DASH/EVT.TAB.REPOSITIONED";
/**
 * Creates the DashboardTabCreated event.
 *
 * @param ctx - dashboard context
 * @param newTabId - identifier of the newly created tab
 * @param index - index at which the new tab was inserted
 * @param correlationId - correlation id to use for this event
 * @returns dashboard tab created event
 *
 * @alpha
 */
export function dashboardTabCreated(ctx, newTabId, index, correlationId) {
    return {
        type: "GDC.DASH/EVT.TAB.CREATED",
        ctx,
        correlationId,
        payload: {
            newTabId,
            index,
        },
    };
}
/**
 * Type guard that checks if an event is a DashboardTabCreated event.
 *
 * @alpha
 */
export const isDashboardTabCreated = (event) => event.type === "GDC.DASH/EVT.TAB.CREATED";
/**
 * Creates the DashboardTabDeleted event.
 *
 * @param ctx - dashboard context
 * @param deletedTabId - identifier of the deleted tab
 * @param previousIndex - index from which the tab was deleted
 * @param nextActiveTabId - identifier of the next active tab, if any
 * @param correlationId - correlation id to use for this event
 * @returns dashboard tab deleted event
 *
 * @alpha
 */
export function dashboardTabDeleted(ctx, deletedTabId, previousIndex, nextActiveTabId, correlationId) {
    return {
        type: "GDC.DASH/EVT.TAB.DELETED",
        ctx,
        correlationId,
        payload: {
            deletedTabId,
            previousIndex,
            nextActiveTabId,
        },
    };
}
/**
 * Type guard that checks if an event is a DashboardTabDeleted event.
 *
 * @param event - event to check
 * @returns true if the event is a DashboardTabDeleted event
 *
 * @alpha
 */
export const isDashboardTabDeleted = (event) => event.type === "GDC.DASH/EVT.TAB.DELETED";
/**
 * Creates the DashboardTabRenamingStarted event.
 * @alpha
 */
export function dashboardTabRenamingStarted(ctx, tabId, correlationId) {
    return {
        type: "GDC.DASH/EVT.TAB.RENAME_MODE.STARTED",
        ctx,
        correlationId,
        payload: { tabId },
    };
}
/**
 * Type guard for {@link IDashboardTabRenamingStarted}.
 * @alpha
 */
export const isDashboardTabRenamingStarted = (event) => event.type === "GDC.DASH/EVT.TAB.RENAME_MODE.STARTED";
/**
 * Creates the DashboardTabRenamingCanceled event.
 * @alpha
 */
export function dashboardTabRenamingCanceled(ctx, tabId, correlationId) {
    return {
        type: "GDC.DASH/EVT.TAB.RENAME_MODE.CANCELED",
        ctx,
        correlationId,
        payload: { tabId },
    };
}
/**
 * Type guard for {@link IDashboardTabRenamingCanceled}.
 * @alpha
 */
export const isDashboardTabRenamingCanceled = (event) => event.type === "GDC.DASH/EVT.TAB.RENAME_MODE.CANCELED";
/**
 * Creates the DashboardTabRenamed event.
 * @alpha
 */
export function dashboardTabRenamed(ctx, tabId, title, correlationId) {
    return {
        type: "GDC.DASH/EVT.TAB.RENAMED",
        ctx,
        correlationId,
        payload: { tabId, title },
    };
}
/**
 * Type guard for {@link IDashboardTabRenamed}.
 * @alpha
 */
export const isDashboardTabRenamed = (event) => event.type === "GDC.DASH/EVT.TAB.RENAMED";
