import type { Field, PatternsFieldType } from './Field';
import type { FieldActions, Schema } from './Schema';
/** A field the source has archived. Sources without archiving omit `archive`. */
export interface ArchivedFieldItem {
    id: string;
    label: string;
    isPii?: boolean;
}
/** A field type a source allows creating, with display metadata for the modal. */
export interface FieldTypeOption {
    /** Stored on the draft; the source maps it back to its native type. */
    id: string;
    label: string;
    namePlaceholder?: string;
    /** Drives the type icon in the modal. */
    patternsType: PatternsFieldType;
}
/** Read/write permission defaults a source supports, per audience. */
export interface FieldPermissions {
    installedApps?: {
        hide?: boolean;
        defaultRead?: boolean;
        defaultWrite?: boolean;
    };
    siteVisitors?: {
        hide?: boolean;
        defaultRead?: boolean;
        defaultWrite?: boolean;
    };
}
/** The values the add/edit field modal collects, source-neutral. */
export interface FieldDraft {
    type?: string;
    key: string;
    name: string;
    readApps: boolean;
    readUsers: boolean;
    writeApps: boolean;
    writeUsers: boolean;
    containsPii: boolean;
}
/** Add/edit/delete capability a source exposes. Present ⇒ field management UI shows. */
export interface FieldManagement {
    /** False ⇒ the add-field CTA is hidden entirely. */
    canAddFields: boolean;
    /** True ⇒ the add-field CTA renders but is disabled. */
    addFieldDisabled: boolean;
    /** Hint text shown beneath the add-field CTA while it is disabled. */
    addFieldDisabledHint?: string;
    canEditField(field: Field): boolean;
    /** `origin` is the UI surface the delete was triggered from; used for BI. */
    deleteField(fieldId: string, origin: string): Promise<void>;
    /** Field types the source allows creating, shown in the add/edit modal. */
    creatableFieldTypes: FieldTypeOption[];
    /** Existing field keys, used by the add modal to reject duplicates. */
    existingFieldKeys: string[];
    /** True when no more fields can be added because a limit is reached. */
    maxReached?: boolean;
    /** Permission defaults; absent ⇒ the modal hides the permissions section. */
    permissions?: FieldPermissions;
    /** True when the source supports marking a field as PII. */
    supportsPii?: boolean;
    addField(draft: FieldDraft): Promise<void>;
    editField(fieldId: string, draft: FieldDraft): Promise<void>;
    /** Current values for an existing field, to prefill the edit modal. */
    getFieldDraft(fieldId: string): FieldDraft | undefined;
}
/** Archiving capability a source exposes. Present ⇒ archive/restore UI shows. */
export interface FieldArchive {
    items: ArchivedFieldItem[];
    shouldDisplay: boolean;
    /** Whether the archived-items panel is currently open. */
    isOpen: boolean;
    openPanel(): void;
    closePanel(): void;
    /** `origin` is the UI surface the action was triggered from; used for BI. */
    archiveField(fieldId: string, origin: string): Promise<void>;
    restoreField(fieldId: string, origin: string): Promise<void>;
    /** Display name for a field, for the confirm-dialog copy. */
    fieldName(fieldId: string): string;
}
/**
 * The source-neutral fields data a collection reads, implemented by each source
 * adapter. Rendering — field modals, filter elements — is not here; it lives in
 * the collection-page layer.
 */
export interface FieldsSource {
    /** Loads the fields (schema/data). The collection runs this once, tracks its
     *  status, and shows a retry toast on failure. */
    load(): Promise<void>;
    fields: Field[];
    filterableFields: Field[];
    /** The fields the manage-fields panel lists — the source's editable fields. */
    manageableFields: Field[];
    /** Column id for a field. Sources that group fields prefix the group; flat sources use the field key. */
    columnIdForField(field: Field): string;
    /** WQL field path for a filter. Sources that group fields prefix the group; flat sources use the field key. */
    queryFieldId(field: Field): string;
    /** The value to display for a field on a row. */
    getCellValue(row: unknown, field: Field): unknown;
    /** Writes a new value for a field on a row, returning the updated row. Present when cells can be edited in place. */
    setCellValue?(row: unknown, field: Field, value: unknown): unknown;
    /** Replaces the source's fields with a freshly-returned map, updating the
     *  columns with no refetch. Present when the source holds its fields in a
     *  mergeable state (e.g. a loaded schema); used after an import creates fields. */
    mergeFields?(fields: Schema['fields']): void;
    /** Present when fields can be added/edited/deleted. */
    fieldManagement?: FieldManagement;
    /** The collection's field-mutation actions (delete/makePrimary/duplicate/…),
     *  driving the shared FieldActions menu. Absent ⇒ no per-field action menu. */
    fieldActions?: FieldActions;
    /** Present when the source supports archiving fields. */
    archive?: FieldArchive;
    /** Present when fields are grouped. Absent ⇒ flat list. */
    groups?: {
        all: string[];
        fieldsForGroup(group: string): Field[];
    };
}
//# sourceMappingURL=FieldsSource.d.ts.map