import { LinkResolver } from 'alinea/backend/resolver/LinkResolver';
import * as Y from 'yjs';
import { Label } from '../Label.js';
import { Shape, ShapeInfo } from '../Shape.js';
import { PostProcess } from '../pages/PostProcess.js';
import { RecordShape } from './RecordShape.js';
export interface UnionRow {
    id: string;
    type: string;
}
export interface UnionMutator<T extends UnionRow> {
    replace: (v: T | undefined) => void;
    set: <K extends keyof T>(k: K, v: T[K]) => void;
}
export declare class UnionShape<T extends UnionRow> implements Shape<T, UnionMutator<T>> {
    label: Label;
    initialValue?: T | undefined;
    protected postProcess?: PostProcess<T> | undefined;
    shapes: Record<string, RecordShape>;
    constructor(label: Label, shapes: Record<string, RecordShape>, initialValue?: T | undefined, postProcess?: PostProcess<T> | undefined);
    innerTypes(parents: Array<string>): Array<ShapeInfo>;
    create(): T;
    typeOfChild<C>(yValue: Y.Map<any>, child: string): Shape<C>;
    toY(value: T): Y.Map<unknown>;
    fromY(map: Y.Map<any>): T;
    applyY(value: T, parent: Y.Map<any>, key: string): void;
    init(parent: Y.Map<any>, key: string): void;
    watch(parent: Y.Map<any>, key: string): (fun: () => void) => () => void;
    mutator(parent: Y.Map<any>, key: string, readOnly: boolean): UnionMutator<T>;
    applyLinks(value: T, loader: LinkResolver): Promise<void>;
}
