import { Field, FieldDescriptor, FullItem, ItemDescriptor, ItemStub } from "../pageModel";
import { EditedField, ModifiedField } from "./editContext";
import { User } from "../../types";
import type { FieldModificationStore } from "./fieldModificationStore";
export type ItemChange = {
    item: ItemDescriptor;
    action: "add" | "delete" | "update";
    parentId?: string;
    changes: {
        fields?: string[];
        children?: boolean;
        properties?: boolean;
        parentId?: string;
        name?: string;
        templateId?: string;
    };
};
export type DeletedItem = {
    item: ItemDescriptor;
    parentId: string;
};
export declare function shouldMarkFieldSaved(modifiedField: Pick<ModifiedField, "isDirty" | "saveSequence" | "value">, value: string | null, saveSequence: number): boolean;
export declare function markFieldSavedInStore(fieldModificationStore: FieldModificationStore | undefined, field: FieldDescriptor, value: string | null, saveSequence: number): void;
export type ItemsRepository = {
    getItems: (descriptors: ItemDescriptor[]) => Promise<FullItem[]>;
    getItemsStubs: (descriptors: ItemDescriptor[], pageItem?: ItemDescriptor) => Promise<ItemStub[]>;
    getItem: (descriptor: ItemDescriptor) => Promise<FullItem | undefined>;
    getField: (fieldDescriptor: FieldDescriptor) => Promise<Field | undefined>;
    updateFieldValue: (fieldDescriptor: FieldDescriptor, user: User, isDirty: boolean, value: any | null, rawValue?: string | null, fieldModificationStore?: FieldModificationStore) => Promise<number>;
    refreshItems: (items: ItemDescriptor[], changes?: {
        properties?: boolean;
        children?: boolean;
        fields?: string[];
    }) => Promise<void>;
    revision: number;
    onFieldSaved: (field: FieldDescriptor, value: string | null, saveSequence: number, fieldModificationStore?: FieldModificationStore) => void;
    onItemsDeleted: (items: DeletedItem[]) => void;
    /** Invalidate version 0 cache entries for a specific item (call when version is added) */
    invalidateVersionZeroCache: (itemId: string, language: string) => void;
    subscribeItemsChanged: (callback: (changes: ItemChange[]) => void) => () => void;
    clear: () => void;
    clearDirtyState: (field: FieldDescriptor, fieldModificationStore?: FieldModificationStore) => void;
};
export declare function useItemsRepository(addRecentEdit: (edit: EditedField) => void, pageItem?: ItemDescriptor, getFieldModificationStores?: () => FieldModificationStore[]): ItemsRepository;
