import { agents, contextConfigs, tools } from "../../db/manage/manage-schema.js";
import { projectScopedWhere } from "./scope-helpers.js";

//#region src/data-access/manage/audit-queries.ts
const listToolIdsByProject = (db) => async (params) => {
	return (await db.select({ id: tools.id }).from(tools).where(projectScopedWhere(tools, params.scopes))).map((r) => r.id);
};
const listContextConfigIdsByProject = (db) => async (params) => {
	return (await db.select({ id: contextConfigs.id }).from(contextConfigs).where(projectScopedWhere(contextConfigs, params.scopes))).map((r) => r.id);
};
const listAgentIdsByProject = (db) => async (params) => {
	return (await db.select({ id: agents.id }).from(agents).where(projectScopedWhere(agents, params.scopes))).map((r) => r.id);
};

//#endregion
export { listAgentIdsByProject, listContextConfigIdsByProject, listToolIdsByProject };