/**
 * Pure role algebra for the teams capability — the tenancy/membership model
 * shared across the fleet. Zero dependencies: no drizzle, no env, no react, no
 * I/O. The DB layer (`./teams/drizzle`), the members API (`./teams/members-api`)
 * and the React surface (`./teams-react`) all build on these functions; this
 * leaf imports nothing back, so a consumer can pull just the role math.
 *
 * Two role ladders, deliberately distinct:
 *   - Organization roles rank the tenant (who owns/administers the org and its
 *     billing). An org owner/admin is an owner of every workspace under it.
 *   - Workspace roles rank a single workspace. They are the access primitive
 *     every route checks via `hasWorkspaceRole(actual, minimum)`.
 *
 * `resolveWorkspaceRole` is the bridge: it folds the org role and the
 * per-workspace role into the one effective workspace role a request runs at.
 */
declare const WORKSPACE_ROLES: readonly ["viewer", "editor", "admin", "owner"];
/** Resolve the union type of all possible workspace role string literals from WORKSPACE_ROLES array */
type WorkspaceRole = typeof WORKSPACE_ROLES[number];
/** Define the list of roles that can be assigned within a workspace */
declare const ASSIGNABLE_WORKSPACE_ROLES: readonly ["viewer", "editor", "admin"];
/** Resolve the set of roles that can be assigned within a workspace */
type AssignableWorkspaceRole = typeof ASSIGNABLE_WORKSPACE_ROLES[number];
/** Define the set of fixed roles available within an organization */
declare const ORGANIZATION_ROLES: readonly ["owner", "admin", "member", "billing"];
/** Resolve a role string from the predefined list of organization roles */
type OrganizationRole = typeof ORGANIZATION_ROLES[number];
/** Define access levels for workspace collaboration as either read or write */
type WorkspaceCollaborationAccess = 'read' | 'write';
/** Define user roles available within a sandbox workspace environment */
type SandboxWorkspaceRole = 'owner' | 'admin' | 'developer' | 'viewer';
/** Map workspace roles to their corresponding hierarchical rank values */
declare const WORKSPACE_ROLE_RANK: Record<WorkspaceRole, number>;
/** Map organization roles to their hierarchical rank for permission and access control purposes */
declare const ORGANIZATION_ROLE_RANK: Record<OrganizationRole, number>;
/** True when `actual` is at least `minimum` on the workspace ladder. */
declare function hasWorkspaceRole(actual: WorkspaceRole, minimum: WorkspaceRole): boolean;
/** True when `actual` is at least `minimum` on the organization ladder. */
declare function hasOrganizationRole(actual: OrganizationRole, minimum: OrganizationRole): boolean;
/** Determine if a value is a valid assignable workspace role among viewer, editor, or admin */
declare function isAssignableWorkspaceRole(value: unknown): value is AssignableWorkspaceRole;
/** Org owners and admins are workspace owners across the whole org. */
declare function organizationRoleGrantsWorkspaceOwner(role: OrganizationRole | string | null | undefined): boolean;
/**
 * The effective workspace role a request runs at: org owner/admin → owner of
 * every workspace; otherwise the explicit per-workspace role (or null = no
 * access). This is the single fold every access check goes through.
 */
declare function resolveWorkspaceRole(organizationRole: OrganizationRole | string | null | undefined, workspaceRole: WorkspaceRole | null | undefined): WorkspaceRole | null;
/**
 * Whether `actorRole` may set/clear a member currently at `targetRole`. Owners
 * can manage anyone; everyone else can only manage members strictly below
 * their own rank (an admin cannot demote another admin or an owner).
 */
declare function canManageWorkspaceMemberRole(actorRole: WorkspaceRole, targetRole: WorkspaceRole): boolean;
/** Map a workspace role to the corresponding collaboration access level */
declare function workspaceRoleToCollaborationAccess(role: WorkspaceRole): WorkspaceCollaborationAccess;
/** Map a workspace role to its corresponding sandbox workspace role */
declare function workspaceRoleToSandboxRole(role: WorkspaceRole): SandboxWorkspaceRole;

export { type AssignableWorkspaceRole as A, type OrganizationRole as O, type SandboxWorkspaceRole as S, WORKSPACE_ROLES as W, ASSIGNABLE_WORKSPACE_ROLES as a, ORGANIZATION_ROLES as b, ORGANIZATION_ROLE_RANK as c, WORKSPACE_ROLE_RANK as d, type WorkspaceCollaborationAccess as e, type WorkspaceRole as f, canManageWorkspaceMemberRole as g, hasOrganizationRole as h, hasWorkspaceRole as i, isAssignableWorkspaceRole as j, workspaceRoleToSandboxRole as k, organizationRoleGrantsWorkspaceOwner as o, resolveWorkspaceRole as r, workspaceRoleToCollaborationAccess as w };
