import { CommonCommandOptions, CommonWriteOptions, KeywordPayload, NamedTableRowView, NamedTableView, RowView, TableRowView, TableView, Watcher, WriteOptions, WaitUntilOptions } from "./vmodel";
import { NamedTable, NamedTableRow, Subtree, Table, TableRow, VSocket } from "./vsocket";
export interface StronglyTypedSubtree {
    readonly raw: Subtree;
}
export declare function same<T extends StronglyTypedSubtree>(a: T | null, b: T | null): boolean;
interface TypeConverters<RawType, UserType> {
    lift: (payload: RawType, socket: VSocket) => UserType;
    lower: (payload: UserType, socket: VSocket) => RawType;
}
export declare class rKeyword<RawType extends KeywordPayload, UserType, ParentType extends StronglyTypedSubtree> {
    readonly parent: ParentType;
    protected readonly m_kw: string;
    protected readonly m_type_converters?: TypeConverters<RawType, UserType> | undefined;
    constructor(parent: ParentType, m_kw: string, m_type_converters?: TypeConverters<RawType, UserType> | undefined);
    read(opts?: CommonCommandOptions & {
        use_cache_if_present?: boolean;
    }): Promise<UserType>;
    wait_until(criterion: (payload: UserType) => boolean, opts?: WaitUntilOptions): Promise<UserType>;
    update(opts?: CommonCommandOptions & {
        defer_subscription?: boolean;
    }): Promise<UserType>;
    watch(handler: (payload: UserType) => void, opts?: CommonCommandOptions & {
        defer_subscription?: boolean;
    }): Promise<Watcher>;
}
export declare class wKeyword<RawType extends KeywordPayload, UserType, ParentType extends StronglyTypedSubtree> {
    readonly parent: ParentType;
    private readonly m_kw;
    private readonly m_type_converters?;
    constructor(parent: ParentType, m_kw: string, m_type_converters?: TypeConverters<RawType, UserType> | undefined);
    write(payload: UserType, opts?: WriteOptions<UserType>): Promise<void>;
}
export declare class rwKeyword<RawType extends KeywordPayload, UserType, ParentType extends StronglyTypedSubtree> extends rKeyword<RawType, UserType, ParentType> {
    constructor(parent: ParentType, m_kw: string, m_type_converters?: TypeConverters<RawType, UserType>);
    write(payload: UserType, opts?: WriteOptions<UserType>): Promise<void>;
}
export declare class duplexKeyword<RawType extends KeywordPayload, UserType, ParentType extends StronglyTypedSubtree> {
    readonly parent: ParentType;
    readonly status: rKeyword<RawType, UserType, ParentType>;
    readonly command: rwKeyword<RawType, UserType, ParentType>;
    constructor(parent: ParentType, kw: string, m_type_converters?: TypeConverters<RawType, UserType>);
}
export declare function liftArray<T, S>(f: (raw: T, socket: VSocket) => S): (raw_elems: T[], socket: VSocket) => S[];
export declare function lowerArray<T, S>(f: (payload: T) => S): (elems: T[]) => S[];
export declare class StronglyTypedTable<S extends StronglyTypedSubtree, R extends TableRowView<S> = TableRowView<S>> implements TableView<S> {
    readonly raw: Table;
    private readonly m_lift;
    constructor(raw: Table, m_lift: (st: TableRow, enclosing_table: StronglyTypedTable<S, R>) => R);
    rows(opts?: CommonCommandOptions): Promise<R[]>;
    allocated_indices(opts?: CommonCommandOptions): Promise<number[]>;
    is_allocated(index: number, opts?: CommonCommandOptions): Promise<boolean>;
    row(index: number, opts?: CommonCommandOptions): R;
    row_unchecked(index: number): R;
}
export declare class StronglyTypedNamedTable<S extends StronglyTypedSubtree, R extends NamedTableRowView<S> = NamedTableRowView<S>> implements NamedTableView<S> {
    readonly raw: NamedTable;
    private readonly m_lift;
    constructor(raw: NamedTable, m_lift: (st: NamedTableRow, enclosing_table: StronglyTypedNamedTable<S, R>) => R);
    allocated_indices(opts?: CommonCommandOptions): Promise<number[]>;
    is_allocated(index: number, opts?: CommonCommandOptions): Promise<boolean>;
    create_row(opts?: CommonWriteOptions & {
        index?: number;
        name?: string;
        allow_reuse_row?: boolean;
    }): Promise<R>;
    rows(opts?: CommonCommandOptions): Promise<R[]>;
    row(index: number, opts?: CommonCommandOptions): R;
    row_unchecked(index: number): R;
}
export declare class StronglyTypedArray<ParentType extends StronglyTypedSubtree, S extends StronglyTypedSubtree, R extends RowView<S> = RowView<S>> {
    readonly parent: ParentType;
    private readonly basename;
    private readonly m_lift;
    constructor(parent: ParentType, basename: string, m_lift: (st: Subtree, index: number, parent: ParentType) => R);
    row(index: number): R;
    get size(): number;
    [Symbol.iterator](): Iterator<R>;
}
export {};
