import type { PrismaClient } from "@prisma/client";
import type { Prisma } from "@prisma/client";
export type DeliveryScope = {
    level: "provider";
} | {
    level: "cohort";
    trainingId: bigint;
    cohortId: bigint;
} | {
    level: "batch";
    trainingId: bigint;
    cohortId: bigint;
    batchId: bigint;
};
export type ProjectScope = {
    role: string | null;
    providerId: bigint | null;
    staffRole?: string | null;
    deliveryScopes?: DeliveryScope[];
    isTpOrgAdmin?: boolean;
};
export declare function hasProjectAccess(prisma: PrismaClient, projectId: bigint, userId: bigint): Promise<boolean>;
export declare function resolveProjectScope(prisma: PrismaClient, projectId: bigint, userId: bigint): Promise<ProjectScope>;
export declare function assertTpAssigned(scope: ProjectScope): void;
export declare function enforceProviderScope(scope: ProjectScope, requestedProviderId: bigint): void;
export declare function hasProviderWideAccess(scope: ProjectScope): boolean;
export declare function isDeliveryScopeAllowed(scope: ProjectScope, args: {
    trainingId?: bigint | null;
    cohortId?: bigint | null;
    batchId?: bigint | null;
}): boolean;
export declare function assertDeliveryScope(scope: ProjectScope, args: {
    trainingId?: bigint | null;
    cohortId?: bigint | null;
    batchId?: bigint | null;
}): void;
export declare function traineeDeliveryScopeWhere(scope: ProjectScope): Prisma.TraineeWhereInput | undefined;
export declare function trainingIdsInScope(scope: ProjectScope): bigint[] | null;
export declare function filterTrainingsForScope<T extends {
    id: bigint;
}>(scope: ProjectScope, trainings: T[]): T[];
export declare function filterCohortsForScope<T extends {
    id: bigint;
    trainingId: bigint;
}>(scope: ProjectScope, cohorts: T[]): T[];
export declare function filterBatchesForScope<T extends {
    id: bigint;
    cohortId: bigint;
    trainingId: bigint;
}>(scope: ProjectScope, batches: T[]): T[];
export declare function serializeDeliveryScopes(scopes: DeliveryScope[] | undefined): ({
    level: "provider";
    trainingId?: undefined;
    cohortId?: undefined;
    batchId?: undefined;
} | {
    level: "cohort";
    trainingId: string;
    cohortId: string;
    batchId?: undefined;
} | {
    level: "batch";
    trainingId: string;
    cohortId: string;
    batchId: string;
})[];
/** Batch IDs the scoped TP user may access; null = no batch filter (provider-wide or non-TP). */
export declare function loadAllowedBatchIds(db: PrismaClient, projectId: bigint, scope: ProjectScope): Promise<bigint[] | null>;
//# sourceMappingURL=scopePolicy.d.ts.map