// (C) 2021-2026 GoodData Corporation
/**
 * The initial load of the dashboard will use this correlation id.
 *
 * @beta
 */
export const InitialLoadCorrelationId = "initialLoad";
/**
 * Creates the InitializeDashboard command.
 *
 * @remarks
 * Dispatching this command will result in the load of all the essential data from the backend and initializing
 * the state of Dashboard to a point where the dashboard can be rendered.
 *
 * Note that the command takes the dashboard to initialize from context - from the properties of the Dashboard
 * component in which it runs:
 *
 * -  If Dashboard component is referencing an existing, persisted dashboard, then the dashboard will be loaded and
 *    rendered.
 *
 * -  If Dashboard component does not reference any dashboard, then the component will initialize for an empty
 *    dashboard with default filter setup.
 *
 * In both cases the essential configuration, permissions and additional metadata gets loaded from the backend.
 *
 * @param config - specify configuration to use for the Dashboard; you MAY provide partial configuration.
 *  During the LoadDashboard processing the Dashboard component will resolve all the missing parts by reading them
 *  from the backend.
 * @param permissions - specify permissions to use when determining whether the user is eligible for some
 *  actions with the dashboard; if you do not specify permissions Dashboard component will load the permissions
 *  from the backend.
 * @param correlationId - specify correlation id to use for this command. this will be included in all
 *  events that will be emitted during the command processing
 * @param initialTabId -
 *
 * @public
 */
export function initializeDashboard(config, permissions, correlationId, initialTabId) {
    return {
        type: "GDC.DASH/CMD.INITIALIZE",
        correlationId,
        payload: {
            config,
            permissions,
            initialTabId,
        },
    };
}
/**
 * Creates the InitializeDashboard command with the persisted dashboard overridden.
 *
 * @remarks
 * Dispatching this command will result in the load of all the essential data from the backend and initializing
 * the state of Dashboard to a point where the dashboard can be rendered.
 *
 * Note that the command takes the dashboard to initialize from context - from the properties of the Dashboard
 * component in which it runs:
 *
 * -  If Dashboard component is referencing an existing, persisted dashboard, then the dashboard will be loaded and
 *    rendered.
 *
 * -  If Dashboard component does not reference any dashboard, then the component will initialize for an empty
 *    dashboard with default filter setup.
 *
 * In both cases the essential configuration, permissions and additional metadata gets loaded from the backend.
 *
 * @param config - specify configuration to use for the Dashboard; you MAY provide partial configuration.
 *  During the LoadDashboard processing the Dashboard component will resolve all the missing parts by reading them
 *  from the backend.
 * @param permissions - specify permissions to use when determining whether the user is eligible for some
 *  actions with the dashboard; if you do not specify permissions Dashboard component will load the permissions
 *  from the backend.
 * @param persistedDashboard - dashboard to use for the persisted dashboard state slice in case it needs to be
 *  different from the dashboard param
 * @param correlationId - specify correlation id to use for this command. this will be included in all
 *  events that will be emitted during the command processing
 * @param initialTabId - specify the initial tab to open when the dashboard is loaded
 *
 * @internal
 */
export function initializeDashboardWithPersistedDashboard(config, permissions, persistedDashboard, correlationId, initialTabId) {
    return {
        type: "GDC.DASH/CMD.INITIALIZE",
        correlationId,
        payload: {
            config,
            permissions,
            persistedDashboard,
            initialTabId,
        },
    };
}
/**
 * Creates the SaveDashboard command. Dispatching this command will result in persisting all the accumulated
 * dashboard modification to backend.
 *
 * The command will not have any effect if dashboard is not initialized or is empty.
 *
 * @param title - new title for the dashboard; if not specified, the current title of the dashboard will be used
 * @param correlationId - specify correlation id to use for this command. this will be included in all
 *  events that will be emitted during the command processing
 *
 * @beta
 */
export function saveDashboard(title, correlationId) {
    return {
        type: "GDC.DASH/CMD.SAVE",
        correlationId,
        payload: {
            title,
        },
    };
}
/**
 * Creates the SaveDashboardAs command.
 *
 * @remarks
 * Dispatching this command will result in creation of a copy of the
 * current dashboard. The copy will reflect the current state of the dashboard including any modifications done
 * on top of the original dashboard.
 *
 * Upon success, a copy of the dashboard will be persisted on the backend. The context of the dashboard component
 * that processed the command is unchanged - it still works with the original dashboard.
 *
 * @param title - new title for the dashboard; if not specified, the title of original dashboard will be used
 * @param switchToCopy - indicate whether the dashboard component should switch to the dashboard that will
 *  be created during save-as; the default is false
 * @param correlationId - specify correlation id to use for this command. this will be included in all
 *  events that will be emitted during the command processing
 *  @param useOriginalFilterContext - indicate whether new dashboard should use original filter context
 *  or the one with current filter selection.
 * @public
 */
export function saveDashboardAs(title, switchToCopy, useOriginalFilterContext, correlationId) {
    return {
        type: "GDC.DASH/CMD.SAVEAS",
        correlationId,
        payload: {
            title,
            switchToCopy,
            useOriginalFilterContext,
        },
    };
}
/**
 * Creates the RenameDashboard command. Dispatching this command will result in rename of the dashboard. The changes
 * will be done only in-memory and have to be flushed to backend using the SaveDashboard command.
 *
 * @param newTitle - new dashboard title
 * @param correlationId - specify correlation id to use for this command. this will be included in all
 *  events that will be emitted during the command processing
 * @beta
 */
export function renameDashboard(newTitle, correlationId) {
    return {
        type: "GDC.DASH/CMD.RENAME",
        correlationId,
        payload: {
            newTitle,
        },
    };
}
/**
 * Creates the ChangeSharing command. Dispatching this command will result in change of sharing status of dashboard. The changes
 * will be done in-memory and also propagated to the backend.
 *
 * @param newSharingProperties - new dashboard sharing properties
 * @param correlationId - specify correlation id to use for this command. this will be included in all
 *  events that will be emitted during the command processing
 * @beta
 */
export function changeSharing(newSharingProperties, correlationId) {
    return {
        type: "GDC.DASH/CMD.SHARING.CHANGE",
        correlationId,
        payload: {
            newSharingProperties,
        },
    };
}
/**
 * Creates the ResetDashboard command. Dispatching this command will result in dropping all in-memory modifications
 * of the dashboard and reverting to a state that is persisted on the backend. In other words reset will get
 * dashboard to a state after the last save.
 *
 * Note: if a dashboard is not saved on a backend, then reset will clear the dashboard to an empty state.
 *
 * Limitation: reset command will have no impact on alerts or scheduled emails. These entites are persisted outside
 * the dashboard and have their own lifecycle.
 *
 * @param correlationId - specify correlation id to use for this command. this will be included in all
 *  events that will be emitted during the command processing
 *
 * @beta
 */
export function resetDashboard(correlationId) {
    return {
        type: "GDC.DASH/CMD.RESET",
        correlationId,
    };
}
/**
 * Creates the DeleteDashboard command. Dispatching this command will result in removal of the currently
 * rendered dashboard from analytical backend and reverting the dashboard component to an 'empty' state where
 * it is initialized to create a new dashboard.
 *
 * @param correlationId - specify correlation id to use for this command. this will be included in all
 *  events that will be emitted during the command processing
 *
 * @beta
 */
export function deleteDashboard(correlationId) {
    return {
        type: "GDC.DASH/CMD.DELETE",
        correlationId,
    };
}
export function exportDashboardToPdf(payloadOrCorrelationId, correlationId) {
    const payload = payloadOrCorrelationId && typeof payloadOrCorrelationId !== "string"
        ? payloadOrCorrelationId
        : undefined;
    const effectiveCorrelationId = typeof payloadOrCorrelationId === "string" ? payloadOrCorrelationId : correlationId;
    return {
        type: "GDC.DASH/CMD.EXPORT.PDF",
        correlationId: effectiveCorrelationId,
        payload,
    };
}
/**
 * Creates the {@link IExportDashboardToExcel} command. Dispatching this command will result in a request to export
 * the dashboard to a EXCEL file. If successful, an instance of {@link IDashboardExportToExcelResolved} will be emitted
 * with the URL of the resulting file.
 *
 * @param mergeHeaders - if true, the headers will be merged into a single row
 * @param exportInfo - if true, the export info will be included in the EXCEL file
 * @param widgetIds - if provided, the widgets with the given ids will be exported
 * @param fileName - if provided, the file will be saved with the given name
 * @param format -
 * @param pdfConfiguration -
 * @param correlationId - specify correlation id to use for this command. this will be included in all
 *  events that will be emitted during the command processing
 *
 * @beta
 */
export function exportDashboardToExcel(mergeHeaders, exportInfo, widgetIds, fileName, format, pdfConfiguration, correlationId) {
    return {
        type: "GDC.DASH/CMD.EXPORT.EXCEL",
        correlationId,
        payload: {
            mergeHeaders,
            exportInfo,
            widgetIds,
            fileName,
            format,
            pdfConfiguration,
        },
    };
}
/**
 * Creates the {@link IExportDashboardToPdfPresentation} command. Dispatching this command will result in a request to export
 * the dashboard to a PDF presentation file. If successful, an instance of {@link IDashboardExportToPdfPresentationResolved} will be emitted
 * with the URL of the resulting file.
 *
 * @param payload - payload to override the dashboard export options. If not provided, the dashboard will be exported with the current filter context and options.
 * @param correlationId - specify correlation id to use for this command. this will be included in all
 *  events that will be emitted during the command processing
 *
 * @beta
 */
export function exportDashboardToPdfPresentation(payload, correlationId) {
    return {
        type: "GDC.DASH/CMD.EXPORT.PDF_PRESENTATION",
        correlationId,
        payload,
    };
}
/**
 * Creates the {@link IExportDashboardToPptPresentation} command. Dispatching this command will result in a request to export
 * the dashboard to a Ppt presentation file. If successful, an instance of {@link IDashboardExportToPptPresentationResolved} will be emitted
 * with the URL of the resulting file.
 *
 * @param payload - payload to override the dashboard export options. If not provided, the dashboard will be exported with the current filter context and options.
 * @param correlationId - specify correlation id to use for this command. this will be included in all
 *  events that will be emitted during the command processing
 *
 * @beta
 */
export function exportDashboardToPptPresentation(payload, correlationId) {
    return {
        type: "GDC.DASH/CMD.EXPORT.PPT_PRESENTATION",
        correlationId,
        payload,
    };
}
/**
 * Creates the {@link ISetDashboardDateFilterConfigMode} command.
 *
 * @remarks
 * Dispatching this command will set the visibility mode of the dashboard date filter to the provided value.
 *
 * @alpha
 * @param mode - The visibility mode to set.
 * @returns set dashboard date filter config mode command
 */
export function setDashboardDateFilterConfigMode(mode) {
    return {
        type: "GDC.DASH/CMD.DATE_FILTER_CONFIG.SET_MODE",
        payload: {
            mode,
        },
    };
}
/**
 * Creates the {@link ISetDashboardAttributeFilterConfigMode} command.
 *
 * @remarks
 * Dispatching the commands will result into setting provided the mode as a mode for the attribute filter.
 *
 *
 * @alpha
 * @param localIdentifier - local identifier of the filter the display form is changed for
 * @param mode - newly added mode
 * @returns change filter mode command
 */
export function setDashboardAttributeFilterConfigMode(localIdentifier, mode) {
    return {
        type: "GDC.DASH/CMD.ATTRIBUTE_FILTER_CONFIG.SET_MODE",
        payload: {
            localIdentifier,
            mode,
        },
    };
}
/**
 * Creates the {@link ISetDashboardMeasureValueFilterConfigMode} command.
 *
 * @alpha
 * @param localIdentifier - local identifier of the measure value filter
 * @param mode - newly selected mode
 * @returns change measure value filter mode command
 */
export function setDashboardMeasureValueFilterConfigMode(localIdentifier, mode) {
    return {
        type: "GDC.DASH/CMD.MEASURE_VALUE_FILTER_CONFIG.SET_MODE",
        payload: {
            localIdentifier,
            mode,
        },
    };
}
/**
 * Creates the {@link ISetDashboardAttributeFilterSelectionType} command.
 *
 * @alpha
 * @param localIdentifier - local identifier of the filter
 * @param selectionType - available mode to set
 * @returns change available mode command
 */
export function setDashboardAttributeFilterSelectionType(localIdentifier, selectionType) {
    return {
        type: "GDC.DASH/CMD.ATTRIBUTE_FILTER_CONFIG.SET_AVAILABLE_MODE",
        payload: {
            localIdentifier,
            selectionType,
        },
    };
}
/**
 * Creates the {@link ISetAttributeFilterLimitingItems} command.
 *
 * @remarks
 * Dispatching the commands will result into setting of provided limiting items to a defined attribute filter.
 *
 *
 * @alpha
 * @param localIdentifier - local identifier of the filter the limiting items are changed for
 * @param limitingItems - limiting items set to the specified attribute filter.
 * @param correlationId - specify correlation id. It will be included in all events that will be emitted during the command processing.
 * @returns change limiting items command
 */
export function setAttributeFilterLimitingItems(localIdentifier, limitingItems, correlationId) {
    return {
        type: "GDC.DASH/CMD.ATTRIBUTE_FILTER_CONFIG.SET_LIMITING_ITEMS",
        correlationId,
        payload: {
            localIdentifier,
            limitingItems,
        },
    };
}
/**
 * Creates the {@link ISetDashboardAttributeFilterConfigDisplayAsLabel} command.
 *
 * @remarks
 * Dispatching the command will result into setting provided label as new label (= display form) used for the displaying attribute filter elements.
 *
 *
 * @alpha
 * @param localIdentifier - local identifier of the filter the label is changed for
 * @param displayAsLabel - newly used display as label
 * @returns change filter mode command
 */
export function setDashboardAttributeFilterConfigDisplayAsLabel(localIdentifier, displayAsLabel) {
    return {
        type: "GDC.DASH/CMD.ATTRIBUTE_FILTER_CONFIG.SET_DISPLAY_AS_LABEL",
        payload: {
            localIdentifier,
            displayAsLabel,
        },
    };
}
/**
 * Creates the {@link ISetDashboardDateFilterWithDimensionConfigMode} command.
 *
 * @remarks
 * Dispatching the commands will result into setting provided the mode as a mode for the date filter.
 *
 *
 * @alpha
 * @param dataSet - dataSet of the filter the mode is changed for
 * @param mode - newly added mode
 * @returns change filter mode command
 */
export function setDashboardDateFilterWithDimensionConfigMode(dataSet, mode) {
    return {
        type: "GDC.DASH/CMD.DATE_FILTER_WITH_DIMENSION_CONFIG.SET_MODE",
        payload: {
            dataSet,
            mode,
        },
    };
}
/**
 * Creates the {@link ISetDateFilterConfigTitle} command.
 *
 * @remarks
 * Dispatching the commands will result into setting provided title as a selected
 * title for the date filter.
 *
 *
 * @beta
 * @param dataSet - date data set ref of the filter the display form is changed for
 * @param title - newly added title
 * @param correlationId - specify correlation id. It will be included in all events that will be emitted during the command processing.
 * @returns change filter title command
 */
export function setDateFilterConfigTitle(dataSet, title, correlationId) {
    return {
        type: "GDC.DASH/CMD.DATE_FILTER_CONFIG.SET_TITLE",
        correlationId,
        payload: {
            dataSet,
            title,
        },
    };
}
/**
 * Creates the {@link IChangeIgnoreExecutionTimestamp} command.
 *
 * @remarks
 * Dispatching the commands will result into setting state to ignore execution timestamp.
 *
 * @alpha
 * @param ignoreExecutionTimestamp -
 * @param correlationId - specify correlation id. It will be included in all events that will be emitted during the command processing.
 * @returns change ignore execution timestamp command
 */
export function changeIgnoreExecutionTimestamp(ignoreExecutionTimestamp, correlationId) {
    return {
        type: "GDC.DASH/CMD.CHANGE_IGNORE_EXECUTION_TIMESTAMP",
        correlationId,
        payload: { ignoreExecutionTimestamp },
    };
}
//# sourceMappingURL=dashboard.js.map