import { ApiModelKind } from '../models/kinds.js';
import { type IThing, Thing } from '../models/Thing.js';
import type { AccessRule, AssociationTarget, AuthenticationConfiguration, AuthorizationConfiguration, ExposedEntitySchema, RateLimitingConfiguration, SessionConfiguration, ExposeOptions } from './types.js';
import { DataDomain } from './DataDomain.js';
import { DependentModel, type DependentModelSchema, type DomainDependency } from './DependentModel.js';
import { ExposedEntity } from './ExposedEntity.js';
/**
 * Contact information for the exposed API.
 */
export interface ApiContact {
    /**
     * The identifying name of the contact person/organization.
     */
    name?: string;
    /**
     * The URL pointing to the contact information. MUST be in the format of a URL.
     */
    url?: string;
    /**
     * The email address of the contact person/organization. MUST be in the format of an email address.
     */
    email?: string;
}
/**
 * License information for the exposed API.
 */
export interface ApiLicense {
    /**
     * The license name used for the API. It is recommended to be an SPDX license identifier.
     */
    name: string;
    /**
     * A URL to the license used for the API. MUST be in the format of a URL.
     */
    url?: string;
}
export interface ApiModelSchema extends DependentModelSchema {
    /**
     * The data domain kind recognizable by the ecosystem.
     */
    kind: typeof ApiModelKind;
    /**
     * The unique key of the API model schema.
     * This is a stable identifier that does not change across versions.
     */
    key: string;
    /**
     * Contains the name, display name, description, and the version of the API model schema.
     */
    info: IThing;
    /**
     * The designated Data Entity that represents a "User".
     * This entity should be marked with the "User" semantic in the Data Modeler.
     *
     * This property is required to publish the API.
     */
    user?: AssociationTarget;
    /**
     * Configuration for how users prove their identity.
     * The API model is invalid if this is not set.
     */
    authentication?: AuthenticationConfiguration;
    /**
     * Configuration for what authenticated users are allowed to do.
     * The API model is invalid if this is not set.
     */
    authorization?: AuthorizationConfiguration;
    /**
     * Configuration for the transport and payload of the user session.
     * The API model is invalid if this is not set.
     */
    session?: SessionConfiguration;
    /**
     * The specific subset of Data Entities to be exposed by this API.
     * These are the entities that are included in the data domain schema.
     */
    exposes: ExposedEntitySchema[];
    /**
     * Optional array of access rules that define the access control policies
     * for the API. These rules are used to enforce security and permissions
     * on the exposed entities.
     *
     * These rules apply to all exposed entities and actions. An API action
     * can declare its own access rules, which will override these.
     */
    accessRule?: AccessRule[];
    /**
     * Optional configuration for API-wide rate limiting and throttling.
     * Defines rules to protect the API from overuse.
     */
    rateLimiting?: RateLimitingConfiguration;
    /**
     * A URL to the Terms of Service for the API.
     */
    termsOfService?: string;
    /**
     * The contact information for the exposed API.
     */
    contact?: ApiContact;
    /**
     * The license information for the API.
     */
    license?: ApiLicense;
}
export declare class ApiModel extends DependentModel {
    #private;
    /**
     * The data domain kind recognizable by the ecosystem.
     */
    kind: typeof ApiModelKind;
    /**
     * The unique key of the data domain schema.
     * This is a stable identifier that does not change across versions.
     */
    key: string;
    /**
     * The description of the domain property.
     */
    info: Thing;
    /**
     * The designated Data Entity that represents a "User".
     * This entity must be marked with the "User" semantic in the Data Modeler.
     *
     * This property is required to publish the API.
     */
    user?: AssociationTarget;
    /**
     * Configuration for how users prove their identity.
     * The API model is invalid if this is not set.
     */
    authentication?: AuthenticationConfiguration;
    /**
     * Configuration for what authenticated users are allowed to do.
     * The API model is invalid if this is not set.
     */
    authorization?: AuthorizationConfiguration;
    /**
     * Configuration for the transport and payload of the user session.
     * The API model is invalid if this is not set.
     */
    session?: SessionConfiguration;
    /**
     * The specific subset of Data Entities to be exposed by this API.
     * These are the entities that are included in the data domain schema.
     */
    accessor exposes: ExposedEntity[];
    /**
     * Optional array of access rules that define the access control policies
     * for the API. These rules are used to enforce security and permissions
     * on the exposed entities.
     *
     * These rules apply to all exposed entities and actions. An API action
     * can declare its own access rules, which will override these.
     */
    accessRule?: AccessRule[];
    /**
     * Optional configuration for API-wide rate limiting and throttling.
     * Defines rules to protect the API from overuse.
     */
    rateLimiting?: RateLimitingConfiguration;
    /**
     * A URL to the Terms of Service for the API.
     */
    accessor termsOfService: string | undefined;
    /**
     * The contact information for the exposed API.
     */
    accessor contact: ApiContact | undefined;
    /**
     * The license information for the API.
     */
    accessor license: ApiLicense | undefined;
    /**
     * A convenience getter that returns the DataDomain associated with this API model.
     * Since the API model can have only one DataDomain,
     * this getter returns the first dependency in the list.
     *
     * The parent interface `DependentModel` allows for multiple dependencies,
     * to unify the dependency management across different models.
     */
    get domain(): DataDomain | undefined;
    static createSchema(input?: Partial<ApiModelSchema>): ApiModelSchema;
    constructor(state?: Partial<ApiModelSchema>, domain?: DomainDependency);
    toJSON(): ApiModelSchema;
    /**
     * This function is used internally by all domain elements to notify that something has changed.
     * Since we want to notify listeners after the operation commits, we use microtask
     * to ensure that the event is dispatched after the current operation.
     */
    notifyChange(): void;
    /**
     * Exposes a new entity in the API model.
     * If the entity already exists, it returns the existing one.
     * @param entity The entity key and domain to expose.
     * @returns The exposed entity.
     */
    exposeEntity(entity: AssociationTarget, options?: ExposeOptions): ExposedEntity;
    /**
     * Follows associations for a newly exposed entity if configured to do so.
     * This creates nested exposures based on the entity's associations.
     *
     * @param parentExposure The root exposure to follow associations from
     * @param options The expose options containing follow configuration
     */
    private followEntityAssociations;
    /**
     * Removes an exposed entity from the API model.
     * @param entity The entity to remove.
     */
    removeEntity(entity: AssociationTarget): void;
    private removeWithChildren;
    /**
     * Returns the exposed entity by its key.
     * @param entityKey The key of the entity to find.
     * @returns The exposed entity or undefined if not found.
     */
    getExposedEntity(entity: AssociationTarget): ExposedEntity | undefined;
    /**
     * Clears the API model for a new entity change.
     * This method resets the dependencies, exposes, user,
     * authentication, authorization, and session properties.
     */
    cleanForEntityChange(): void;
    /**
     * Attaches a DataDomain to this API model.
     * This method clears any existing dependencies and sets the new domain.
     *
     * @param domain The DataDomain to attach to this API model.
     * @throws Error if the domain does not have a version set in its info.
     */
    attachDataDomain(domain: DataDomain): void;
}
//# sourceMappingURL=ApiModel.d.ts.map