// (C) 2021-2026 GoodData Corporation
import { put } from "redux-saga/effects";
import { filterDrillsByDrillEvent } from "../../../_staging/drills/drillingUtils.js";
import { drillRequested, drillResolved } from "../../events/drill.js";
export function* drillHandler(ctx, cmd) {
    yield put(drillRequested(ctx, cmd.payload.drillEvent, cmd.payload.drillContext, cmd.correlationId));
    // TODO: better signature
    const validDrillDefinitions = filterDrillsByDrillEvent(cmd.payload.drillEvent.drillDefinitions, cmd.payload.drillEvent);
    return drillResolved(ctx, { ...cmd.payload.drillEvent, drillDefinitions: validDrillDefinitions }, cmd.payload.drillContext, cmd.correlationId);
}
