import { IApiAssociationShape, IApiPropertyShape } from '../../amf/definitions/Shapes.js';
import { IThing, Thing } from '../../models/Thing.js';
import { DataEntity, IDataEntity } from './DataEntity.js';
import { DataNamespace } from './DataNamespace.js';
import { DataAssociationKind } from '../../models/kinds.js';
import type { AssociationBinding, AssociationBindings, AssociationWebBindings } from '../Bindings.js';
import { type DataAttributeAttribute } from '../DataFormat.js';
/**
 * Describes association target of an entity
 * @deprecated
 */
export interface AssociationTarget {
    /**
     * The key of the associated entity.
     */
    key: string;
    /**
     * The key of the namespace to look for entities.
     * By default it is the current (root) namespace. When this is set the program
     * will look into `foreign` of the root namespace for the definition
     * of the entity.
     */
    namespace?: string;
}
/**
 * Describes an association between entities. An association is another property of an entity.
 * The `name` is the name of the property and the value is the associated target or targets.
 *
 * An association can have multiple targets to allow describing the model as `allOf`, `anyOf` and `oneOf` schemas.
 * When the association has only one target, then generated schema cannot have union types.
 *
 * Depending on the schema translation an association can be embedded as a sub-object in the generated schema
 * or can be references via a primary key.
 * @deprecated
 */
export interface IDataAssociation {
    kind: typeof DataAssociationKind;
    /**
     * The key of the association.
     */
    key: string;
    /**
     * The data association description.
     */
    info: IThing;
    /**
     * Wether the data association is required.
     */
    required?: boolean;
    /**
     * Whether the data association allows multiple items.
     */
    multiple?: boolean;
    /**
     * The list of keys associated with the entity through this association.
     * An association without a target is considered invalid and discarded when processing the values.
     * When multiple associations are set then we are dealing with an union.
     */
    targets?: AssociationTarget[];
    /**
     * The schema allowing to translate the model into a specific format (like JSON, RAML, XML, etc.)
     *
     * When this is defined then it is used as the schema. When this is not defined it uses
     * referenced entities schemas. Note, changes in the referenced entities may not be propagated
     * to schemas altered by the user.
     */
    schema?: IApiAssociationShape;
    /**
     * The list of bindings for this property.
     *
     * A binding defines a translation from a data model to a specific format.
     * For example allows to define properties required to generate AMF shape and therefore RAML/OAS shapes for web APIs
     * or a protocol buffer schema.
     */
    bindings?: AssociationBinding[];
}
/**
 * Describes an association between entities. An association is a relationship defined on an entity
 * that links it to one or more other entities. The association has a `name` which is used as the
 * property name in the context of the parent entity, and it connects to a set of `targets`
 * representing the associated entities.
 *
 * An association can have multiple targets to allow describing the model as `allOf`, `anyOf`, or `oneOf`
 * schemas. When the association has only one target, then the generated schema cannot have union types.
 *
 * Depending on the schema translation, an association can be embedded as a sub-object in the generated
 * schema, or it can be referenced via a primary key.
 *
 * ## Key Concepts
 *
 * - **Targets**: An association's `targets` specify the entities that this association points to.
 *     Each target is defined by:
 *     -   `key`: The key of the target entity.
 *     -   `namespace` (optional): The key of the namespace where the target entity is defined.
 *         If not specified, it defaults to the current namespace.
 *
 * -   **Cardinality**:
 *     -   `multiple` (boolean): Indicates whether the association allows multiple target entities.
 *         If `true`, it's a to-many relationship; otherwise, it's a to-one relationship.
 *
 * -   **Schema**:
 *     -   `schema` (optional): A custom schema for the association, allowing manual definition of the
 *         association's structure in specific formats (e.g., JSON, RAML, XML).
 *         When provided, this schema overrides the automatically generated schema based on the
 *         target entities.
 *         -   **Important**: If a custom schema is defined and changes are made to the referenced
 *             entities, those changes **will not** be automatically propagated to the custom schema.
 *             This means the custom schema may become outdated and no longer accurately reflect the
 *             structure of the target entities.
 *
 * - **Hidden**:
 *  - `hidden`: (boolean) Defines if this association is a part of the schema or not.
 * @deprecated
 */
export declare class DataAssociation {
    root: DataNamespace;
    kind: string;
    key: string;
    /**
     * The description of the data association.
     */
    info: Thing;
    /**
     * Wether the data association is required.
     */
    required?: boolean;
    /**
     * Whether the data association allows multiple items.
     */
    multiple?: boolean;
    /**
     * The list of keys associated with the entity through this association.
     * An association without a target is considered invalid and discarded when processing the values.
     * When multiple associations are set then we are dealing with an union.
     */
    targets: AssociationTarget[];
    /**
     * The schema allowing to translate the model into a specific format (like JSON, RAML, XML, etc.)
     *
     * When this is defined then it is used as the schema. When this is not defined it uses
     * referenced entities schemas. Note, changes in the referenced entities may not be propagated
     * to schemas altered by the user.
     */
    schema?: IApiAssociationShape;
    /**
     * The list of bindings for this property.
     *
     * A binding defines a translation from a data model to a specific format.
     * For example allows to define properties required to generate AMF shape and therefore RAML/OAS shapes for web APIs
     * or a protocol buffer schema.
     */
    bindings: AssociationBinding[];
    /**
     * Returns true when the association has 0 or 1 targets.
     */
    get isSingle(): boolean;
    /**
     * Creates an instance of DataAssociation from a target entity key.
     * Note, this entity will have no name. The default name is used instead.
     *
     * @param root The namespace root.
     * @param target The target entity key.
     * @param namespace The optional key of the target association when different to the current one.
     * @returns A new `DataAssociation` instance.
     */
    static fromTarget(root: DataNamespace, target: string, namespace?: string): DataAssociation;
    /**
     * Creates an instance of DataAssociation from a name, without defining a target.
     *
     * @param root The namespace root.
     * @param name The name of the association.
     * @returns A new `DataAssociation` instance.
     */
    static fromName(root: DataNamespace, name: string): DataAssociation;
    /**
     * @param input The data association definition to restore.
     */
    constructor(root: DataNamespace, input?: string | IDataAssociation);
    /**
     * Initializes the association using provided data.
     *
     * @param init - The data association definition to restore.
     */
    new(init: IDataAssociation): this;
    /**
     * Validates if the input object is a valid `DataAssociation` definition.
     * Throws a `ValidationError` if the input is invalid.
     *
     * @param input The object to validate.
     * @throws {ValidationError} When the validation fails.
     * @deprecated
     */
    static validate(input: unknown): void;
    /**
     * Generates an object representing the association, suitable for serialization.
     *
     * @returns A plain object representation of the `DataAssociation`.
     */
    toJSON(): IDataAssociation;
    /**
     * Retrieves the list of target entities.
     *
     * @returns An array of `DataEntity` instances representing the targets of this association.
     */
    getTargets(): DataEntity[];
    /**
     * Removes self from the parent entity and the namespace definition.
     */
    remove(): void;
    /**
     * Adds a target entity to the association.
     * If the entity comes from another namespace then it is set as a foreign entity.
     *
     * @param entity - The `DataEntity` instance to add.
     */
    addTarget(entity: DataEntity): void;
    /**
     * Adds a target entity to the association.
     *
     * @param entity - The `IDataEntity` definition or just its key.
     * @param namespace - The key of the foreign namespace this entity belongs to.
     *      Do not set this value for local entities.
     */
    addTarget(entity: IDataEntity | string, namespace?: string): void;
    /**
     * Removes a target entity from the targets list.
     *
     * @param init The key of an entity, its instance, or schema.
     */
    removeTarget(init: string | DataEntity | IDataEntity): void;
    /**
     * Creates a Property Shape of AMF.
     * The property itself is auto-generated. If the `schema` is defined then it is used
     * as the `range` of the property. Otherwise basic shape is generated for the range.
     *
     * This is a preferred way of reading the AMF shape as this synchronizes changed
     * data properties with the shape definition.
     *
     * @returns AMF property shape definition.
     */
    toApiShape(): IApiPropertyShape;
    /**
     * @deprecated Use the `getParentInstance()` method instead.
     */
    getParent(): DataEntity;
    /**
     * Retrieves the parent entity of this association.
     *
     * @returns The `DataEntity` instance that contains this association.
     */
    getParentInstance(): DataEntity;
    /**
     * Creates the `schema` object if missing and returns it.
     * @returns The schema object.
     */
    ensureSchema(): IApiAssociationShape;
    /**
     * Checks whether the passed value is one of the supported data property attributes.
     * @param value The value to test
     * @returns True when the passed value is one of the supported data property attributes.
     * @deprecated
     */
    static isValidAttribute(value: unknown): value is DataAttributeAttribute;
    /**
     * Creates if not existing and returns web bindings definition.
     * @returns The web binding definition
     */
    getWebBinding(): AssociationWebBindings;
    /**
     * Returns the schema value of the binding, if any was created.
     * @param type The type of the binding to read.
     * @returns The binding schema, if any
     */
    readBinding(type: 'web' | 'protobuf'): AssociationBindings | undefined;
    /**
     * Checks whether the association is a child of the given namespace, data model, or an entity.
     * The relationship doesn't have to be direct, as long as the association is in the hierarchy it will return true.
     *
     * @param key The key of the parent to check.
     * @returns True if this data association is a child of the given namespace, data model, or an entity
     */
    isChildOf(key: string): boolean;
}
//# sourceMappingURL=DataAssociation.d.ts.map