"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.EntityShareRequest = void 0;
class EntityShareRequest {
    constructor(params) {
        var _a;
        if (!params.accessControlKeys.length)
            throw new Error('Access control keys should not be empty');
        this.explicitDelegator = params.explicitDelegator;
        this.explicitDelegate = params.explicitDelegate;
        this.accessControlKeys = params.accessControlKeys;
        this.secretIds = params.secretIds;
        this.encryptionKeys = params.encryptionKeys;
        this.owningEntityIds = params.owningEntityIds;
        this.exchangeDataId = params.exchangeDataId;
        this.encryptedExchangeDataId = params.encryptedExchangeDataId;
        this.requestedPermissions = (_a = params.requestedPermissions) !== null && _a !== void 0 ? _a : EntityShareRequest.RequestedPermissionInternal.MAX_WRITE;
    }
}
exports.EntityShareRequest = EntityShareRequest;
(function (EntityShareRequest) {
    EntityShareRequest.RequestedPermissionEnum = {
        /**
         * The new secure delegation will give full-read access to the delegate. If in future iCure is going to support
         * fine-grained access control a user may have limited read access to an entity, and in such case the request
         * would fail (similarly to [FULL_WRITE]).
         */
        FULL_READ: 'FULL_READ',
        /**
         * The new secure delegation will give maximum access to the delegate, depending on the rights of the delegator.
         * If the delegator has full-write access the delegate will also have full-write access else the delegate will
         * have full-read access.
         */
        MAX_WRITE: 'MAX_WRITE',
        /**
         * The new secure delegation will give full-write access to the delegate. If the delegator does not have
         * full-write access to the entity the request will fail.
         */
        FULL_WRITE: 'FULL_WRITE',
    };
    EntityShareRequest.RequestedPermissionInternal = {
        /**
         * Request to create a root delegation on the entity. Usually new entities are created with a root delegation
         * for the creator data owner and no other data owners will be able to obtain root permissions, but there are
         * some situations where other data owners can create root delegations on existing entities:
         * - If a data owner has a legacy delegation on an entity he can create a root delegation. This is necessary in
         * cases where the data owner wants to share an entity with another data owner using the new delegation format
         * but does not have a delegation in the new format yet (the data owner creates a new root delegation self->self
         * and then creates a delegation self->other).
         * - A patient data owner is always allowed to create a root delegation for himself
         *
         * A root delegation gives full write permissions to the data owners which can access it (usually a root
         * delegation should be accessible only for one data owner, it should be a delegation a->a) and does not depend
         * on any other delegation: this means that no data owners except for the data owners with the root permission
         * can revoke it.
         */
        ROOT: 'ROOT',
        FULL_READ: EntityShareRequest.RequestedPermissionEnum.FULL_READ,
        MAX_WRITE: EntityShareRequest.RequestedPermissionEnum.MAX_WRITE,
        FULL_WRITE: EntityShareRequest.RequestedPermissionEnum.FULL_WRITE,
    };
})(EntityShareRequest || (exports.EntityShareRequest = EntityShareRequest = {}));
//# sourceMappingURL=EntityShareRequest.js.map