import { Stream } from "../../../common/util/Stream";
import { TypeDBTransaction } from "../../connection/TypeDBTransaction";
import { Attribute } from "../thing/Attribute";
import { ThingType } from "./ThingType";
import { Concept } from "../Concept";
import { Value } from "../value/Value";
import Annotation = ThingType.Annotation;
import Transitivity = Concept.Transitivity;
import ValueType = Concept.ValueType;
/**
* Attribute types represent properties that other types can own.
* Attribute types have a value type. This value type is fixed and unique for every given instance of the attribute type.
* Other types can own an attribute type. That means that instances of these other types can own an instance of this attribute type.
* This usually means that an object in our domain has a property with the matching value.
* Multiple types can own the same attribute type, and different instances of the same type or different types can share ownership of the same attribute instance.
*/
export interface AttributeType extends ThingType {
/**
* The ValueType of this AttributeType.
*/
readonly valueType: ValueType;
/**
* Adds and returns an Attribute of this AttributeType with the given value.
*
* ### Examples
*
* ```ts
* attribute = attributeType.put(transaction, value)
* ```
*
* @param transaction - The current transaction
* @param value - New Attribute’s value
*/
put(transaction: TypeDBTransaction, value: Value): Promise;
/** {@inheritDoc AttributeType#put} */
putBoolean(transaction: TypeDBTransaction, value: boolean): Promise;
/** {@inheritDoc AttributeType#put} */
putLong(transaction: TypeDBTransaction, value: number): Promise;
/** {@inheritDoc AttributeType#put} */
putDouble(transaction: TypeDBTransaction, value: number): Promise;
/** {@inheritDoc AttributeType#put} */
putString(transaction: TypeDBTransaction, value: string): Promise;
/** {@inheritDoc AttributeType#put} */
putDateTime(transaction: TypeDBTransaction, value: Date): Promise;
/**
* Retrieves an Attribute of this AttributeType
* with the given value if such Attribute exists.
* Otherwise, returns None.
*
* ### Examples
*
* ```ts
* attribute = attributeType.get(transaction, value)
* ```
*
* @param transaction - The current transaction
* @param value - Attribute’s value
*/
get(transaction: TypeDBTransaction, value: Value): Promise;
/** {@inheritDoc AttributeType#get} */
getBoolean(transaction: TypeDBTransaction, value: boolean): Promise;
/** {@inheritDoc AttributeType#get} */
getLong(transaction: TypeDBTransaction, value: number): Promise;
/** {@inheritDoc AttributeType#get} */
getDouble(transaction: TypeDBTransaction, value: number): Promise;
/** {@inheritDoc AttributeType#get} */
getString(transaction: TypeDBTransaction, value: string): Promise;
/** {@inheritDoc AttributeType#get} */
getDateTime(transaction: TypeDBTransaction, value: Date): Promise;
/** @inheritdoc */
getSupertype(transaction: TypeDBTransaction): Promise;
/**
* Sets the supplied AttributeType as the supertype of the current AttributeType.
*
* ### Examples
*
* ```ts
* attributeType.setSupertype(transaction, superAttributeType).resolve();
* ```
*
* @param transaction The current transaction
* @param superAttributeType The AttributeType to set as the supertype of this AttributeType
*/
setSupertype(transaction: TypeDBTransaction, type: AttributeType): Promise;
/** @inheritdoc */
getSupertypes(transaction: TypeDBTransaction): Stream;
/** @inheritdoc */
getSubtypes(transaction: TypeDBTransaction): Stream;
getSubtypes(transaction: TypeDBTransaction, valueType: ValueType): Stream;
getSubtypes(transaction: TypeDBTransaction, transitivity: Transitivity): Stream;
/**
*
*/
getSubtypes(transaction: TypeDBTransaction, valueType: ValueType, transitivity: Transitivity): Stream;
/**
* Retrieves all direct and indirect (or direct only) Attributes
* that are instances of this AttributeType.
*
* ### Examples
*
* ```ts
* attributeType.getInstances(transaction)
* attributeType.getInstances(transaction, Transitivity.EXPLICIT)
* ```
*
* @param transaction - The current transaction
* @param transitivity - Transitivity.TRANSITIVE for direct and indirect subtypes, Transitivity.EXPLICIT for direct subtypes only
*/
getInstances(transaction: TypeDBTransaction, transitivity: Transitivity): Stream;
getInstances(transaction: TypeDBTransaction): Stream;
/**
* Retrieve all Things that own an attribute of this AttributeType.
* Optionally, filtered by Annotations.
*
* ### Examples
*
* ```ts
* attributeType.getOwners(transaction)
* attributeType.getOwners(transaction, [Annotation.UNIQUE])
* attributeType.getOwners(transaction, Transitivity.TRANSITIVE)
* attributeType.getOwners(transaction, [Annotation.UNIQUE], Transitivity.TRANSITIVE)
* ```
*
* @param transaction - The current transaction
* @param annotations - Only retrieve ThingTypes that have an attribute of this AttributeType with all given Annotations
* @param transitivity - Transitivity.TRANSITIVE for direct and inherited ownership, Transitivity.EXPLICIT for direct ownership only
*/
getOwners(transaction: TypeDBTransaction, annotations: Annotation[], transitivity: Transitivity): Stream;
getOwners(transaction: TypeDBTransaction): Stream;
getOwners(transaction: TypeDBTransaction, annotations: Annotation[]): Stream;
getOwners(transaction: TypeDBTransaction, transitivity: Transitivity): Stream;
/**
* Retrieves the regular expression that is defined for this AttributeType.
*
* ### Examples
*
* ```ts
* attributeType.getRegex(transaction)
* ```
*
* @param transaction - The current transaction
*/
getRegex(transaction: TypeDBTransaction): Promise;
/**
* Sets a regular expression as a constraint for this AttributeType. Values of all Attributes of this type (inserted earlier or later) should match this regex.
* Can only be applied for AttributeTypes with a string value type.
*
* ### Examples
*
* ```ts
* attributeType.setRegex(transaction, regex)
* ```
*
* @param transaction - The current transaction
* @param regex - Regular expression
*/
setRegex(transaction: TypeDBTransaction, regex: string): Promise;
/**
* Removes the regular expression that is defined for this AttributeType.
*
* ### Examples
*
* ```ts
* attributeType.unsetRegex(transaction)
* ```
*
* @param transaction - The current transaction
*/
unsetRegex(transaction: TypeDBTransaction): Promise;
}
export declare namespace AttributeType {
const NAME = "attribute";
function proto(attributeType: AttributeType): import("typedb-protocol/proto/concept").AttributeType;
}