// (C) 2026 GoodData Corporation
function now() {
    return Date.now();
}
const startRequested = (state, action) => {
    const { dashboardId } = action.payload;
    const current = state.byDashboardId[dashboardId] ?? {};
    state.byDashboardId[dashboardId] = {
        ...current,
        runId: undefined,
        status: "RUNNING",
        startedAt: now(),
        updatedAt: now(),
    };
};
const started = (state, action) => {
    const { dashboardId, runId, status } = action.payload;
    const current = state.byDashboardId[dashboardId] ?? {};
    state.byDashboardId[dashboardId] = {
        ...current,
        runId,
        status,
        startedAt: current.startedAt ?? now(),
        updatedAt: now(),
    };
};
const statusUpdated = (state, action) => {
    const { dashboardId, status } = action.payload;
    const current = state.byDashboardId[dashboardId] ?? {};
    state.byDashboardId[dashboardId] = {
        ...current,
        status,
        updatedAt: now(),
    };
};
const reset = (state, action) => {
    const { dashboardId } = action.payload;
    delete state.byDashboardId[dashboardId];
};
export const dashboardSummaryWorkflowReducers = {
    startRequested,
    started,
    statusUpdated,
    reset,
};
//# sourceMappingURL=dashboardSummaryWorkflowReducers.js.map