/**
 * Group registration and settings via platform IPC.
 */
import path from "path";
import { getContext } from "../client.js";
import { writeIpcFile } from "../ipc.js";
function groupFolder() {
    return process.env.NANOCLAW_GROUP_FOLDER ?? "";
}
function messagesDir(ipcDir) {
    return path.join(ipcDir, "messages");
}
function tasksDir(ipcDir) {
    return path.join(ipcDir, "tasks");
}
export async function registerGroup(params, ipcDir) {
    const dir = ipcDir ?? getContext().ipcDir;
    writeIpcFile(messagesDir(dir), {
        type: "register_group",
        jid: params.jid,
        name: params.name,
        folder: params.folder,
        trigger: params.trigger,
        groupFolder: groupFolder(),
    });
}
export async function updateGroupSettings(params, ipcDir) {
    const dir = ipcDir ?? getContext().ipcDir;
    writeIpcFile(tasksDir(dir), {
        type: "update_group_settings",
        jid: process.env.NANOCLAW_CHAT_JID,
        requiresTrigger: params.requiresTrigger,
        groupFolder: groupFolder(),
    });
}
//# sourceMappingURL=groups.js.map