"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const commonTypes_1 = require("./commonTypes");
const contractWrapperBase_1 = require("./contractWrapperBase");
const controllerService_1 = require("./controllerService");
/**
 * Abstract base class for all Arc scheme contract wrapper classes. A scheme is defined as an Arc
 * contract that can be registered with and can thus interact with a DAO controller.
 */
class SchemeWrapperBase extends contractWrapperBase_1.ContractWrapperBase {
    /**
     * Minimum permissions required by the scheme
     */
    getDefaultPermissions() {
        return commonTypes_1.DefaultSchemePermissions.MinimumPermissions;
    }
    /**
     * Returns the scheme permissions.
     * @param avatarAddress
     */
    getSchemePermissions(avatarAddress) {
        return Promise.resolve(this.getDefaultPermissions());
    }
    /**
     * Returns this scheme's permissions.
     * @param avatarAddress
     */
    _getSchemePermissions(avatarAddress) {
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            const controllerService = new controllerService_1.ControllerService(avatarAddress);
            const controller = yield controllerService.getController();
            const permissions = yield controller.getSchemePermissions(this.address, avatarAddress);
            return commonTypes_1.SchemePermissions.fromString(permissions);
        });
    }
}
exports.SchemeWrapperBase = SchemeWrapperBase;
//# sourceMappingURL=schemeWrapperBase.js.map