import { getSession } from "../lib/neo4j.js";
export async function scheduleCancel(params) {
    const { accountId, eventId, note } = params;
    const now = new Date().toISOString();
    const noteEntry = note
        ? `\n[${now}] Cancelled: ${note}`
        : `\n[${now}] Cancelled`;
    const neo4jSession = getSession();
    try {
        const result = await neo4jSession.run(`MATCH (e:Event {eventId: $eventId, accountId: $accountId})
       SET e.eventStatus = 'cancelled',
           e.updatedAt = $now,
           e.notes = COALESCE(e.notes, '') + $noteEntry
       RETURN e`, { eventId, accountId, now, noteEntry });
        if (result.records.length === 0) {
            throw new Error(`Event not found: ${eventId}`);
        }
    }
    finally {
        await neo4jSession.close();
    }
}
//# sourceMappingURL=schedule-cancel.js.map