import { filterPlanningEventsByEnabledDomains } from "./planning-canonical-sync-domains.js";
import { commitCanonicalTaskStateEvents } from "./task-state-canonical-commit.js";
import { isGitTaskStateCanonicalAuthority } from "./task-state-canonical-authority.js";
export async function commitCanonicalPlanningEvents(input) {
    if (!isGitTaskStateCanonicalAuthority(input.ctx)) {
        return null;
    }
    const events = filterPlanningEventsByEnabledDomains(input.ctx, input.events);
    if (events.length === 0) {
        return null;
    }
    return commitCanonicalTaskStateEvents({
        ctx: input.ctx,
        store: input.store,
        planning: input.planning,
        events: [],
        planningEvents: events,
        policyApproval: input.policyApproval
    });
}
