import type { SceneEntity } from "./entityStore.js"; export interface PossessionSwappedEvent { userId: string; entityId: string; previousEntityId: string; } export interface PossessionEntities { get(id: string): SceneEntity | null; update(id: string, patch: { role?: SceneEntity["role"]; }): boolean; } export interface PossessionEvents { emit(name: "possession.swapped", payload: PossessionSwappedEvent): void; } export interface PossessionDeps { entities: PossessionEntities; events?: PossessionEvents; } export interface PossessionSnapshot { owned: Record; active: Record; } export interface Possession { own(userId: string, entityId: string): void; disown(userId: string, entityId: string): void; owns(userId: string, entityId: string): boolean; /** Unique owner of an explicitly owned pawn, or undefined when absent or shared. Does not create ownership. */ ownerOf(entityId: string): string | undefined; listOwned(userId: string): readonly string[]; active(userId: string): string; possess(userId: string, entityId: string): { reason: string; } | null; /** Snapshot every user's owned entities and active pawn for a whole-world save. */ snapshotAll(): PossessionSnapshot; /** Restore every user's owned entities and active pawn from a {@link snapshotAll} payload. Entity roles are restored by the entity snapshot, not re-applied here. */ hydrateAll(state: PossessionSnapshot): void; } export declare function createPossession(deps: PossessionDeps): Possession;