import type { Field, PatternsFieldType } from './Field';
import type { Schema, LoadedSchema } from './Schema';
import type { FieldPermissions } from './FieldsSource';
import type { OffsetQuery, OffsetQueryResult } from '../hooks/paginationModeConfig';
import type { TranslationsKeys } from '../services/translations';
/** A field type a source allows creating. The label keys are resolved to text by the UI. */
export interface CreatableFieldType {
    patternsType: PatternsFieldType;
    labelKey: TranslationsKeys;
    namePlaceholderKey?: TranslationsKeys;
}
/** Collection-query config derived from a source, ready to spread into a collection hook. */
export interface SchemaCollectionConfig<T> {
    queryName: string;
    paginationMode: 'offset';
    fetchData: (query: OffsetQuery) => Promise<OffsetQueryResult<T>>;
    itemKey: (item: T) => string;
    itemName: (item: T) => string;
}
/** What a caller passes. Only `collectionId` and `loadSchema` are required. */
export interface SchemaSourceInput<T> {
    collectionId: string;
    loadSchema: () => Promise<LoadedSchema<T>>;
    paginationMode?: 'offset';
    /** Stable row identity. Default: `row[idField]`. */
    itemKey?: (item: T) => string;
    /** Row display label. Default: `row[displayField]`. */
    itemName?: (item: T) => string;
    /** Fields free-text search runs against. Default: `[displayField]`. */
    searchableFieldIds?: (schema: Schema) => string[];
    /** Field types the add-field modal offers. Default: none. */
    creatableFieldTypes?: CreatableFieldType[];
    /** Default: `schemaPermissions.createField`. */
    canAddFields?: (schema: Schema) => boolean;
    /** Default: `schemaPermissions.updateField && !field.isSystem`. */
    canEditField?: (field: Field, schema: Schema) => boolean;
    /** Default: `schemaPermissions.deleteField && !field.isSystem`. */
    canDeleteField?: (field: Field, schema: Schema) => boolean;
    /** Permission defaults shown in the modal. Absent ⇒ no permissions section. */
    fieldPermissions?: FieldPermissions;
    /** Default: `false`. */
    supportsPii?: boolean;
}
/** The resolved source: defaults filled, `loadSchema` memoized. */
export interface SchemaSource<T> {
    readonly collectionId: string;
    loadSchema: () => Promise<LoadedSchema<T>>;
    readonly collectionConfig: SchemaCollectionConfig<T>;
    readonly creatableFieldTypes: CreatableFieldType[];
    searchableFieldIds: (schema: Schema) => string[];
    canAddFields: (schema: Schema) => boolean;
    canEditField: (field: Field, schema: Schema) => boolean;
    canDeleteField: (field: Field, schema: Schema) => boolean;
    readonly fieldPermissions?: FieldPermissions;
    readonly supportsPii: boolean;
}
/** Fills source-neutral defaults over `input` and memoizes the load so the collection
 *  query and the table columns share a single fetch. */
export declare function defineSchemaSource<T>(input: SchemaSourceInput<T>): SchemaSource<T>;
//# sourceMappingURL=SchemaSource.d.ts.map