import { Logger } from '@evan.network/dbcp';
import { Container, ContainerConfig, ContainerOptions } from './container';
import { Profile } from '../../profile/profile';
/**
 * possible entry types for entries in index
 */
export declare enum DigitalTwinEntryType {
    AccountId = 0,
    Container = 1,
    FileHash = 2,
    GenericContract = 3,
    Hash = 4,
    DigitalTwin = 5
}
/**
 * config for digital twin
 */
export interface DigitalTwinConfig {
    /** account id of user, that interacts with digital twin */
    accountId: string;
    /** address of a ``DigitalTwin`` instance, can be ENS or contract address */
    containerConfig: ContainerConfig;
    /** address of a ``DigitalTwin`` instance, can be ENS or contract address */
    address?: string;
    /** description has to be passed to ``.create`` to apply it to to contract */
    description?: any;
    /** factory address can be passed to ``.create`` for customer digital twin factory*/
    factoryAddress?: string;
}
/**
 * container for digital twin entry values
 */
export interface DigitalTwinIndexEntry {
    /** type of entry in index */
    entryType?: DigitalTwinEntryType;
    /** raw value (``bytes32`` hash) */
    raw?: any;
    /** decrypted/loaded value */
    value?: any;
}
/**
 * data for verifications for digital twins
 */
export interface DigitalTwinVerificationEntry {
    /** name of the verification (full path) */
    topic: string;
    /** domain of the verification, this is a subdomain under 'verifications.evan', so passing 'example' will link verifications */
    descriptionDomain?: string;
    /** if true, verifications created under  this path are invalid, defaults to ``false`` */
    disableSubverifications?: boolean;
    /** expiration date, for the verification, defaults to `0` (does not expire) */
    expirationDate?: number;
    /** json object which will be stored in the verification */
    verificationValue?: string;
}
/**
 * options for DigitalTwin constructor (uses same properties as ContainerOptions)
 */
export interface DigitalTwinOptions extends ContainerOptions {
    profile: Profile;
}
/**
 * helper class for managing digital twins
 *
 * @class      DigitalTwin (name)
 */
export declare class DigitalTwin extends Logger {
    static defaultDescription: {
        name: string;
        description: string;
        author: string;
        version: string;
        dbcpVersion: number;
    };
    private config;
    private contract;
    private options;
    private mutexes;
    /**
     * Create digital twin contract.
     *
     * @param      {DigitalTwinOptions}  options  twin runtime options
     * @param      {DigitalTwinConfig}   config   configuration for the new twin instance
     */
    static create(options: DigitalTwinOptions, config: DigitalTwinConfig): Promise<DigitalTwin>;
    /**
     * Gets bookmarked twins from profile.
     *
     * @param      {DigitalTwinOptions}  options  twin runtime options
     */
    static getFavorites(options: DigitalTwinOptions): Promise<Array<string>>;
    /**
     * Check if a valid contract is located under the specified address, which allows to check for
     * twins before actually loading them.
     *
     * @param      {DigitalTwinOptions}  options     twin runtime options
     * @param      {string}                  ensAddress  ens address that should be checked
     */
    static getValidity(options: DigitalTwinOptions, ensAddress: string): Promise<{
        valid: boolean;
        exists: boolean;
        error: Error;
    }>;
    /**
     * Create new DigitalTwin instance. This will not create a smart contract contract but is used
     * to load existing containers. To create a new contract, use the static ``create`` function.
     *
     * @param      {DigitalTwinOptions}  options  runtime-like object with required modules
     * @param      {DigitalTwinConfig}   config   digital twin related config
     */
    constructor(options: DigitalTwinOptions, config: DigitalTwinConfig);
    /**
     * Add the digital twin with given address to profile.
     */
    addAsFavorite(): Promise<void>;
    /**
     * Add verifications to this twin; this will also add verifications to contract description
     *
     * @param      {DigitalTwinVerificationEntry[]}  verifications  list of verifications to add
     */
    addVerifications(verifications: DigitalTwinVerificationEntry[]): Promise<void>;
    /**
     * Create new `Container` instances and add them as entry to twin.
     *
     * @param      {{ [id: string]: Partial<ContainerConfig> }}  containers  object with containers to
     *                                                                       create, name is used as
     *                                                                       entry name in twin
     */
    createContainers(containers: {
        [id: string]: Partial<ContainerConfig>;
    }): Promise<{
        [id: string]: Container;
    }>;
    /**
     * Check if digital twin contract already has been loaded, load from address / ENS if required
     * and throw an error, when no contract exists or the description doesn't match the twin
     * specifications.
     */
    ensureContract(): Promise<void>;
    /**
     * Get contract address of underlying DigitalTwin.
     */
    getContractAddress(): Promise<string>;
    /**
     * Returns description from digital twin.
     */
    getDescription(): Promise<any>;
    /**
     * Get all entries from index contract.
     */
    getEntries(): Promise<{
        [id: string]: DigitalTwinIndexEntry;
    }>;
    /**
     * Get single entry from index contract. When this twin has other twins as its entries, properties
     * from those can be selected by building a path of properties.
     *
     * @param      {string}  name    entry name or path to data in linked twin
     */
    getEntry(name: string): Promise<DigitalTwinIndexEntry>;
    /**
     * Gets verifications from description and fetches list of verifications for each of them.
     */
    getVerifications(): Promise<any[]>;
    /**
     * Check if this digital twin is bookmarked in profile.
     */
    isFavorite(): Promise<boolean>;
    /**
     * Removes the current twin from the favorites in profile.
     */
    removeFromFavorites(): Promise<void>;
    /**
     * Write given description to digital twins DBCP.
     *
     * @param      {any}  description  description to set (`public` part)
     */
    setDescription(description: any): Promise<void>;
    /**
     * Set multiple entries at index contract.
     *
     * @param      {{[id: string]: DigitalTwinIndexEntry}}  entries  entries to set
     */
    setEntries(entries: {
        [id: string]: DigitalTwinIndexEntry;
    }): Promise<void>;
    /**
     * Set entry in index contract; entries are unique, setting the same name a second time will
     * overwrite the first value.
     *
     * @param      {string}                    name       entry name
     * @param      {string}                    value      value to set
     * @param      {DigitalTwinEntryType}  entryType  type of given value
     */
    setEntry(name: string, value: string | Container, entryType: DigitalTwinEntryType): Promise<void>;
    /**
     * get mutex for keyword, this can be used to lock several sections during updates
     *
     * @param      {string}  name    name of a section; e.g. 'sharings', 'schema'
     * @return     {Mutex}   Mutex instance
     */
    private getMutex;
    /**
     * add type and value from raw value to entry
     *
     * @param      {DigitalTwinIndexEntry}  entry   The entry
     */
    private processEntry;
}
