import type { Db } from "@rudderhq/db";
import { organizationMemberships } from "@rudderhq/db";
import type { PermissionKey, PrincipalType } from "@rudderhq/shared";
type MembershipRow = typeof organizationMemberships.$inferSelect;
type GrantInput = {
    permissionKey: PermissionKey;
    scope?: Record<string, unknown> | null;
};
export declare function accessService(db: Db): {
    isInstanceAdmin: (userId: string | null | undefined) => Promise<boolean>;
    canUser: (orgId: string, userId: string | null | undefined, permissionKey: PermissionKey) => Promise<boolean>;
    hasPermission: (orgId: string, principalType: PrincipalType, principalId: string, permissionKey: PermissionKey) => Promise<boolean>;
    getMembership: (orgId: string, principalType: PrincipalType, principalId: string) => Promise<MembershipRow | null>;
    ensureMembership: (orgId: string, principalType: PrincipalType, principalId: string, membershipRole?: string | null, status?: "pending" | "active" | "suspended") => Promise<{
        createdAt: Date;
        status: string;
        id: string;
        updatedAt: Date;
        orgId: string;
        principalType: string;
        principalId: string;
        membershipRole: string | null;
    }>;
    listMembers: (orgId: string) => Promise<{
        createdAt: Date;
        status: string;
        id: string;
        updatedAt: Date;
        orgId: string;
        principalType: string;
        principalId: string;
        membershipRole: string | null;
    }[]>;
    listActiveUserMemberships: (orgId: string) => Promise<{
        createdAt: Date;
        status: string;
        id: string;
        updatedAt: Date;
        orgId: string;
        principalType: string;
        principalId: string;
        membershipRole: string | null;
    }[]>;
    copyActiveUserMemberships: (sourceCompanyId: string, targetCompanyId: string) => Promise<{
        createdAt: Date;
        status: string;
        id: string;
        updatedAt: Date;
        orgId: string;
        principalType: string;
        principalId: string;
        membershipRole: string | null;
    }[]>;
    setMemberPermissions: (orgId: string, memberId: string, grants: GrantInput[], grantedByUserId: string | null) => Promise<{
        createdAt: Date;
        status: string;
        id: string;
        updatedAt: Date;
        orgId: string;
        principalType: string;
        principalId: string;
        membershipRole: string | null;
    } | null>;
    promoteInstanceAdmin: (userId: string) => Promise<{
        createdAt: Date;
        id: string;
        userId: string;
        updatedAt: Date;
        role: string;
    }>;
    demoteInstanceAdmin: (userId: string) => Promise<{
        createdAt: Date;
        id: string;
        userId: string;
        updatedAt: Date;
        role: string;
    }>;
    listUserCompanyAccess: (userId: string) => Promise<{
        createdAt: Date;
        status: string;
        id: string;
        updatedAt: Date;
        orgId: string;
        principalType: string;
        principalId: string;
        membershipRole: string | null;
    }[]>;
    setUserCompanyAccess: (userId: string, orgIds: string[]) => Promise<{
        createdAt: Date;
        status: string;
        id: string;
        updatedAt: Date;
        orgId: string;
        principalType: string;
        principalId: string;
        membershipRole: string | null;
    }[]>;
    setPrincipalGrants: (orgId: string, principalType: PrincipalType, principalId: string, grants: GrantInput[], grantedByUserId: string | null) => Promise<void>;
    listPrincipalGrants: (orgId: string, principalType: PrincipalType, principalId: string) => Promise<{
        createdAt: Date;
        id: string;
        updatedAt: Date;
        scope: Record<string, unknown> | null;
        orgId: string;
        principalType: string;
        principalId: string;
        permissionKey: string;
        grantedByUserId: string | null;
    }[]>;
    setPrincipalPermission: (orgId: string, principalType: PrincipalType, principalId: string, permissionKey: PermissionKey, enabled: boolean, grantedByUserId: string | null, scope?: Record<string, unknown> | null) => Promise<void>;
};
export {};
//# sourceMappingURL=access.d.ts.map