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<{
        id: string;
        orgId: string;
        status: string;
        createdAt: Date;
        updatedAt: Date;
        principalType: string;
        principalId: string;
        membershipRole: string | null;
    }>;
    listMembers: (orgId: string) => Promise<{
        id: string;
        orgId: string;
        status: string;
        createdAt: Date;
        updatedAt: Date;
        principalType: string;
        principalId: string;
        membershipRole: string | null;
    }[]>;
    listActiveUserMemberships: (orgId: string) => Promise<{
        id: string;
        orgId: string;
        status: string;
        createdAt: Date;
        updatedAt: Date;
        principalType: string;
        principalId: string;
        membershipRole: string | null;
    }[]>;
    copyActiveUserMemberships: (sourceCompanyId: string, targetCompanyId: string) => Promise<{
        id: string;
        orgId: string;
        status: string;
        createdAt: Date;
        updatedAt: Date;
        principalType: string;
        principalId: string;
        membershipRole: string | null;
    }[]>;
    setMemberPermissions: (orgId: string, memberId: string, grants: GrantInput[], grantedByUserId: string | null) => Promise<{
        id: string;
        orgId: string;
        status: string;
        createdAt: Date;
        updatedAt: Date;
        principalType: string;
        principalId: string;
        membershipRole: string | null;
    } | null>;
    promoteInstanceAdmin: (userId: string) => Promise<{
        id: string;
        createdAt: Date;
        updatedAt: Date;
        role: string;
        userId: string;
    }>;
    demoteInstanceAdmin: (userId: string) => Promise<{
        id: string;
        createdAt: Date;
        updatedAt: Date;
        role: string;
        userId: string;
    }>;
    listUserCompanyAccess: (userId: string) => Promise<{
        id: string;
        orgId: string;
        status: string;
        createdAt: Date;
        updatedAt: Date;
        principalType: string;
        principalId: string;
        membershipRole: string | null;
    }[]>;
    setUserCompanyAccess: (userId: string, orgIds: string[]) => Promise<{
        id: string;
        orgId: string;
        status: string;
        createdAt: Date;
        updatedAt: Date;
        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<{
        id: string;
        orgId: string;
        scope: Record<string, unknown> | null;
        createdAt: Date;
        updatedAt: Date;
        permissionKey: string;
        principalType: string;
        principalId: 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