import { IccAuthApi, IccTopicApi } from '../icc-api';
import { IccCryptoXApi } from './icc-crypto-x-api';
import * as models from '../icc-api/model/models';
import { ListOfIds, TimingInfo, Topic, TopicRole } from '../icc-api/model/models';
import { IccDataOwnerXApi } from './icc-data-owner-x-api';
import { AuthenticationProvider } from './auth/AuthenticationProvider';
import { SecureDelegation } from '../icc-api/model/SecureDelegation';
import { ShareMetadataBehaviour } from './crypto/ShareMetadataBehaviour';
import { ShareResult } from './utils/ShareResult';
import { EntityShareRequest } from '../icc-api/model/requests/EntityShareRequest';
import { XHR } from '../icc-api/api/XHR';
import { EncryptedEntityXApi } from './basexapi/EncryptedEntityXApi';
import { FilterChainTopic } from '../icc-api/model/FilterChainTopic';
import { PaginatedListTopic } from '../icc-api/model/PaginatedListTopic';
import AccessLevelEnum = SecureDelegation.AccessLevelEnum;
import RequestedPermissionEnum = EntityShareRequest.RequestedPermissionEnum;
import { SubscriptionOptions } from './utils';
import { AbstractFilter } from './filters/filters';
import { Connection } from '../icc-api/model/Connection';
import { SecretIdUseOption } from './crypto/SecretIdUseOption';
export declare class IccTopicXApi extends IccTopicApi implements EncryptedEntityXApi<models.Topic> {
    private readonly crypto;
    private readonly dataOwnerApi;
    private readonly authApi;
    private readonly autofillAuthor;
    private readonly encryptedFields;
    constructor(host: string, headers: {
        [key: string]: string;
    }, crypto: IccCryptoXApi, dataOwnerApi: IccDataOwnerXApi, authApi: IccAuthApi, autofillAuthor: boolean, authenticationProvider?: AuthenticationProvider, encryptedKeys?: Array<string>, fetchImpl?: (input: RequestInfo, init?: RequestInit) => Promise<Response>);
    get headers(): Promise<Array<XHR.Header>>;
    /**
     * Creates a new instance of topic with initialised encryption metadata (not in the database).
     * @param user the current user.
     * @param patient the patient this topic refers to.
     * @param c initialised data for the topic. Metadata such as id, creation data, etc. will be automatically initialised, but you can specify
     * other kinds of data or overwrite generated metadata with this. You can't specify encryption metadata.
     * @param options optional parameters:
     * - additionalDelegates: delegates which will have access to the entity in addition to the current data owner and delegates from the
     * auto-delegations. Must be an object which associates each data owner id with the access level to give to that data owner. May overlap with
     * auto-delegations, in such case the access level specified here will be used.
     * - sfkOption: specifies which sfk of the owning entity to use.
     * - ignoreAutoDelegations: if true the data won't be shared with the autodelegations of the user, but only with additional delegates
     * - alternateRootDelegation: by default a new entity is created with a root delegation from self to self. In keyless mode this is not possible,
     * and instead the root delegation will be from self to another. You have to specify which delegate will be part of the root delegation.
     * @return a new instance of topic.
     */
    newInstance(user: models.User, patient: models.Patient | null, c?: Topic, // TODO: Why this isn't Topic?
    options?: {
        additionalDelegates?: {
            [dataOwnerId: string]: AccessLevelEnum;
        };
        sfkOption?: SecretIdUseOption;
        ignoreAutoDelegations?: boolean;
        alternateRootDelegation?: string;
    }): Promise<models.Topic>;
    decrypt(topics: Array<models.Topic>): Promise<models.Topic[]>;
    encrypt(topics: Array<models.Topic>): Promise<Array<models.Topic>>;
    /**
     * Create and share a new topic with other participants.
     * @param body the topic to create.
     * @return the created topic.
     */
    createTopic(body: Topic): Promise<Topic>;
    /**
     * @param topic a topic
     * @return the id of the patient that the topic refers to, retrieved from the encrypted metadata. Normally there should only be one element
     * in the returned array, but in case of entity merges there could be multiple values.
     */
    decryptPatientIdOf(topic: models.Topic): Promise<string[]>;
    /**
     * @return if the logged data owner has write access to the content of the given topic
     */
    hasWriteAccess(topic: models.Topic): Promise<boolean>;
    /**
     * Share an existing topic with other data owners, allowing them to access the non-encrypted data of the topic and optionally also
     * the encrypted content, with read-only or read-write permissions.
     * @param delegateId the id of the data owner which will be granted access to the topic.
     * @param topic the topic to share.
     * @param options optional parameters to customize the sharing behaviour:
     * - shareSecretIds: specifies which secret ids of the entity should be shared. If not provided all secret ids available to the current user will be shared
     * - shareEncryptionKey: specifies if the encryption key of the access log should be shared with the delegate, giving access to all encrypted
     * content of the entity, excluding other encrypted metadata (defaults to {@link ShareMetadataBehaviour.IF_AVAILABLE}).
     * - sharePatientId: specifies if the id of the patient that this topic refers to should be shared with the delegate (defaults to
     * {@link ShareMetadataBehaviour.IF_AVAILABLE}).
     * - requestedPermissions: the requested permissions for the delegate, defaults to {@link RequestedPermissionEnum.MAX_WRITE}.
     * @return the updated entity
     */
    shareWith(delegateId: string, topic: models.Topic, options?: {
        shareSecretIds?: string[];
        requestedPermissions?: RequestedPermissionEnum;
        shareEncryptionKey?: ShareMetadataBehaviour;
        sharePatientId?: ShareMetadataBehaviour;
    }): Promise<models.Topic>;
    /**
     * Share an existing topic with other data owners, allowing them to access the non-encrypted data of the topic and optionally also
     * the encrypted content, with read-only or read-write permissions.
     * @param topic the topic to share.
     * @param delegates associates the id of data owners which will be granted access to the entity, to the following sharing options:
     * - shareSecretIds: specifies which secret ids of the entity should be shared. If not provided all secret ids available to the current user will be shared
     * - shareEncryptionKey: specifies if the encryption key of the access log should be shared with the delegate, giving access to all encrypted
     * content of the entity, excluding other encrypted metadata (defaults to {@link ShareMetadataBehaviour.IF_AVAILABLE}). Note that by default a
     * topic does not have encrypted content.
     * - sharePatientId: specifies if the id of the patient that this topic refers to should be shared with the delegate (defaults to
     * {@link ShareMetadataBehaviour.IF_AVAILABLE}).
     * - requestedPermissions: the requested permissions for the delegate, defaults to {@link RequestedPermissionEnum.MAX_WRITE}.
     * @return the updated entity
     */
    shareWithMany(topic: models.Topic, delegates: {
        [delegateId: string]: {
            shareSecretIds?: string[];
            requestedPermissions?: RequestedPermissionEnum;
            shareEncryptionKey?: ShareMetadataBehaviour;
            sharePatientId?: ShareMetadataBehaviour;
        };
    }): Promise<models.Topic>;
    /**
     * Share an existing topic with other data owners, allowing them to access the non-encrypted data of the topic and optionally also
     * the encrypted content, with read-only or read-write permissions.
     * @param topic the topic to share.
     * @param delegates associates the id of data owners which will be granted access to the entity, to the following sharing options:
     * - shareSecretIds: specifies which secret ids of the entity should be shared. If not provided all secret ids available to the current user will be shared
     * - shareEncryptionKey: specifies if the encryption key of the access log should be shared with the delegate, giving access to all encrypted
     * content of the entity, excluding other encrypted metadata (defaults to {@link ShareMetadataBehaviour.IF_AVAILABLE}). Note that by default a
     * topic does not have encrypted content.
     * - sharePatientId: specifies if the id of the patient that this topic refers to should be shared with the delegate (defaults to
     * {@link ShareMetadataBehaviour.IF_AVAILABLE}).
     * - requestedPermissions: the requested permissions for the delegate, defaults to {@link RequestedPermissionEnum.MAX_WRITE}.
     * @return a promise which will contain the result of the operation: the updated entity if the operation was successful or details of the error if
     * the operation failed.
     */
    tryShareWithMany(topic: models.Topic, delegates: {
        [delegateId: string]: {
            shareSecretIds?: string[];
            requestedPermissions?: RequestedPermissionEnum;
            shareEncryptionKey?: ShareMetadataBehaviour;
            sharePatientId?: ShareMetadataBehaviour;
        };
    }): Promise<ShareResult<models.Topic>>;
    getDataOwnersWithAccessTo(entity: models.Topic): Promise<{
        permissionsByDataOwnerId: {
            [p: string]: AccessLevelEnum;
        };
        hasUnknownAnonymousDataOwners: boolean;
    }>;
    getEncryptionKeysOf(entity: models.Topic): Promise<string[]>;
    /**
     * Filter and decrypt topics by the given filter.
     * @param body the filter to apply.
     * @param startDocumentId the document id to start from (inclusive).
     * @param limit the maximum number of topics to return in the page.
     * @param collectTiming add timing information to the response
     * @return a paginated list of topics.
     */
    filterTopicsBy(body: FilterChainTopic, startDocumentId?: string, limit?: number, collectTiming?: false): Promise<PaginatedListTopic>;
    filterTopicsBy(body: FilterChainTopic, startDocumentId?: string, limit?: number, collectTiming?: true): Promise<PaginatedListTopic & TimingInfo>;
    /**
     * Obtain the topic with the given id and decrypt it.
     * @param id the id of the topic to retrieve.
     * @return the decrypted topic.
     */
    getTopic(id: string): Promise<Topic>;
    /**
     * Obtain the topics with the given ids and decrypt them.
     * @param body the ids of the topics to retrieve.
     * @return the decrypted topics.
     */
    getTopics(body: ListOfIds): Promise<Array<Topic>>;
    /**
     * Update and encrypt the given topic.
     * @param body the topic to update.
     * @return the updated decrypted topic.
     */
    modifyTopic(body: Topic): Promise<Topic>;
    /**
     * @internal this method is for internal use only and may be changed without notice
     * @param body data owner id of the data owner to which the participant should be added and the topic role of the participant.
     * @param topicId Id of the topic to which the participant should be added.
     */
    addParticipant(body: {
        dataOwnerId: string;
        topicRole: TopicRole;
    }, topicId: string): Promise<Topic>;
    /**
     * This method is similar to {@link addParticipant} but it also shares the topic with the data owner before adding the participant.
     * @param body data owner id of the data owner to which the participant should be added and the topic role of the participant.
     * @param topic the topic to share and to which the participant should be added.
     * @return the updated topic.
     */
    addParticipantWithTopic(body: {
        dataOwnerId: string;
        topicRole: TopicRole;
    }, topic: Topic): Promise<Topic>;
    /**
     * Remove the participant with the given data owner id from the topic with the given id.
     * @param body data owner id of the participant to remove.
     * @param topicId Id of the topic from which the participant should be removed.
     * @return the updated decrypted topic.
     */
    removeParticipant(body: {
        dataOwnerId: string;
    }, topicId: string): Promise<Topic>;
    subscribeToTopicEvents(eventTypes: ('CREATE' | 'UPDATE' | 'DELETE')[], filter: AbstractFilter<Topic> | undefined, eventFired: (message: Topic) => Promise<void>, options?: SubscriptionOptions): Promise<Connection>;
    createDelegationDeAnonymizationMetadata(entity: Topic, delegates: string[]): Promise<void>;
}
