import { ScopeConfig, ScopeLevel, ScopedTable } from "../../db/manage/scope-definitions.js";
import { SQL } from "drizzle-orm";

//#region src/data-access/manage/scope-helpers.d.ts

/**
 * Build a WHERE clause that filters by all scope columns for the given level.
 *
 * The columns and config shape are both derived from `SCOPE_KEYS` in
 * `scope-definitions.ts`, so they cannot drift apart.
 */
declare function scopedWhere<L extends ScopeLevel>(level: L, table: ScopedTable<L>, scopes: ScopeConfig<L>): SQL | undefined;
declare const tenantScopedWhere: <T extends ScopedTable<"tenant">>(table: T, scopes: ScopeConfig<"tenant">) => SQL<unknown> | undefined;
declare const projectScopedWhere: <T extends ScopedTable<"project">>(table: T, scopes: ScopeConfig<"project">) => SQL<unknown> | undefined;
declare const agentScopedWhere: <T extends ScopedTable<"agent">>(table: T, scopes: ScopeConfig<"agent">) => SQL<unknown> | undefined;
declare const subAgentScopedWhere: <T extends ScopedTable<"subAgent">>(table: T, scopes: ScopeConfig<"subAgent">) => SQL<unknown> | undefined;
declare const toolScopedWhere: <T extends ScopedTable<"tool">>(table: T, scopes: ScopeConfig<"tool">) => SQL<unknown> | undefined;
//#endregion
export { agentScopedWhere, projectScopedWhere, scopedWhere, subAgentScopedWhere, tenantScopedWhere, toolScopedWhere };