import PopupTemplate from "@arcgis/core/PopupTemplate";
import Collection from "@arcgis/core/core/Collection";
import type { ResourceHandle } from "@arcgis/core/core/Handles.js";
import type SpatialReference from "@arcgis/core/geometry/SpatialReference";
import FeatureType from "@arcgis/core/layers/support/FeatureType";
import Field from "@arcgis/core/layers/support/Field";
import FieldInfo from "@arcgis/core/popup/FieldInfo";
import type { FieldJson } from "../json/FieldJson.js";
import { type GeometryJsonType } from "../json/GeometryJson.js";
import type { TypeJson } from "../json/TypeJson.js";
import type { InitializableCollection } from "../support/InitializableCollectionProxy.js";
import type { PropertyDefs, SerializeMode } from "../support/Serializable.js";
import { Settings, type SettingsEvents } from "../support/Settings.js";
import type { CollectionAfterAddEventHandler, CollectionAfterRemoveEventHandler, CollectionBeforeAddEventHandler, CollectionBeforeRemoveEventHandler, CollectionChangeEventHandler, GeometryType } from "../support/esri.js";
import { fieldWithArcadeXRegex, fieldWithRelationshipRegex } from "../utilities/field.js";
import type { FieldExtensionProperties } from "./FieldExtension.js";
import { FieldExtension } from "./FieldExtension.js";
export { fieldWithArcadeXRegex, fieldWithRelationshipRegex };
/**
 * The collection of field extensions belonging to a {@link data/Schema!Schema}.
 */
export interface FieldExtensionCollection extends InitializableCollection<FieldExtensionProperties, FieldExtension> {
    /**
     * Returns the field extension for the given field.
     *
     * @param field The field to get the field extension for.
     */
    forField(field: Field): FieldExtension;
}
/**
 * The collection of fields belonging to a {@link data/Schema!Schema}.
 */
export interface FieldCollection extends Collection<Field> {
    /**
     * The fields in the collection that reference an arcade expression.
     */
    expressionFields: Collection<Field>;
}
/**
 * Properties that can be passed into the constructor for
 * {@link data/Schema!Schema}.
 */
export interface SchemaProperties {
    /**
     * See {@link data/Schema!Schema.geometryType}.
     */
    geometryType?: GeometryJsonType;
    /**
     * See {@link data/Schema!Schema.spatialReference}.
     */
    spatialReference?: SpatialReference;
    /**
     * See {@link data/Schema!Schema.primaryKeyField}.
     */
    primaryKeyField?: string;
    /**
     * See {@link data/Schema!Schema.displayField}.
     */
    displayField?: string;
    /**
     * See {@link data/Schema!Schema.fields}.
     */
    fields?: (Field | FieldJson)[];
    /**
     * See {@link data/Schema!Schema.fieldExtensions}.
     */
    fieldExtensions?: (FieldExtension | FieldExtensionProperties)[];
    /**
     * See {@link data/Schema!Schema.timeZone}.
     */
    timeZone?: string;
    /**
     * See {@link data/Schema!Schema.typeIdField}.
     */
    typeIdField?: string;
    /**
     * See {@link data/Schema!Schema.types}.
     */
    types?: (TypeJson | FeatureType)[];
}
/**
 * Events emitted by the {@link data/Schema!Schema} class.
 */
export interface SchemaEvents extends SettingsEvents<SchemaProperties> {
    /**
     * Emitted after a field extension is added to the collection.
     */
    "after-add": CollectionAfterAddEventHandler<FieldExtension>;
    /**
     * Emitted after a field extension is removed from the collection.
     */
    "after-remove": CollectionAfterRemoveEventHandler<FieldExtension>;
    /**
     * Emitted before a field extension is added to the collection.
     */
    "before-add": CollectionBeforeAddEventHandler<FieldExtension>;
    /**
     * Emitted before a field extension is removed from the collection.
     */
    "before-remove": CollectionBeforeRemoveEventHandler<FieldExtension>;
    /**
     * Emitted when a field extension in the collection changes.
     */
    change: CollectionChangeEventHandler<FieldExtension>;
}
/**
 * Metadata about features, such as fields, domains, geometry type, etc.
 */
export declare class Schema extends Settings<SchemaProperties> {
    /**
     * @deprecated Do not directly reference this property. Use EventNames and
     *   EventTypes helpers from @arcgis/core/Evented.
     */
    "@eventTypes": SchemaEvents;
    /**
     * The field extensions associated with each field of the schema.
     */
    readonly fieldExtensions: FieldExtensionCollection;
    /**
     * A collection of Field objects describing each field in the schema.
     */
    readonly fields: FieldCollection;
    /**
     * A set of watch handles that get cleaned up when the class instance is
     * destroyed.
     */
    protected readonly _watchHandles: ResourceHandle[];
    /**
     * A cache of the primary key field name used to speed up lookup.
     */
    protected _primaryKeyField: string | undefined;
    /**
     * The spatial reference of the schema. Can be defined using a well-known ID
     * (WKID) or well-known text (WKT).
     */
    get spatialReference(): SpatialReference;
    set spatialReference(value: SpatialReference);
    /**
     * The name of the field containing the feature's primary key (value that
     * uniquely identifies a feature).
     */
    get primaryKeyField(): string;
    set primaryKeyField(value: string);
    /**
     * The name of the field containing the display name of the feature.
     */
    get displayField(): string;
    set displayField(value: string);
    /**
     * The type of geometry. This property will be undefined if the data is not
     * spatial.
     */
    get geometryType(): GeometryType;
    set geometryType(value: GeometryType);
    /**
     * Whether the schema has spatial data.
     */
    get hasGeometry(): boolean;
    /**
     * The time zone that the data is stored in. The default is UTC.
     */
    get timeZone(): string;
    set timeZone(value: string);
    /**
     * The name of the field holding the type ID or subtypes for the features.
     */
    get typeIdField(): string;
    set typeIdField(value: string);
    /**
     * A collection of types or subtypes for the features.
     */
    get types(): Collection<FeatureType>;
    constructor(properties?: SchemaProperties);
    /**
     * Generates a popup template field info object from an esri field.
     *
     * @param field The field to generate the field info object from.
     */
    static createFieldInfoFromField(field: Field): FieldInfo;
    /**
     * Cleans up resources used by the schema.
     */
    destroy(): void;
    /**
     * Finds a field by field name.
     *
     * @param name The name of the field to search for.
     * @returns The matching field, or `undefined` if there is no match.
     */
    findFieldByName(name: string): Field;
    toJSON(serializeMode?: SerializeMode): SchemaProperties;
    /**
     * Generates an esri PopupTemplate from the fields in this schema.
     */
    createPopupTemplate(): PopupTemplate;
    /**
     * Creates an array of FieldInfos that includes all fields within the
     * Schema.
     */
    createAllFieldInfos(): FieldInfo[];
    protected _getSerializableProperties(): PropertyDefs<SchemaProperties>;
}
