'use strict';
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const commonTypes_1 = require("../commonTypes");
const contractWrapperFactory_1 = require("../contractWrapperFactory");
const proposalGeneratorBase_1 = require("../proposalGeneratorBase");
const web3EventService_1 = require("../web3EventService");
class GenericSchemeWrapper extends proposalGeneratorBase_1.ProposalGeneratorBase {
    constructor() {
        super(...arguments);
        this.name = 'GenericScheme';
        this.friendlyName = 'Generic Scheme';
        this.factory = exports.GenericSchemeFactory;
    }
    getParametersHash(params) {
        return this._getParametersHash(params.voteParametersHash, params.votingMachineAddress, params.contractToCall);
    }
    setParameters(params) {
        if (!params.contractToCall) {
            throw new Error(`contractToCall is not defined`);
        }
        this.validateStandardSchemeParams(params);
        return super._setParameters('GenericScheme.setParameters', params.txEventContext, params.voteParametersHash, params.votingMachineAddress, params.contractToCall);
    }
    getDefaultPermissions() {
        return commonTypes_1.DefaultSchemePermissions.GenericScheme;
    }
    getSchemePermissions(avatarAddress) {
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            return this._getSchemePermissions(avatarAddress);
        });
    }
    getSchemeParameters(avatarAddress) {
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            return this._getSchemeParameters(avatarAddress);
        });
    }
    getParameters(paramsHash) {
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            const params = yield this.getParametersArray(paramsHash);
            return {
                contractToCall: params[2],
                voteParametersHash: params[0],
                votingMachineAddress: params[1],
            };
        });
    }
}
exports.GenericSchemeWrapper = GenericSchemeWrapper;
exports.GenericSchemeFactory = new contractWrapperFactory_1.ContractWrapperFactory('GenericScheme', GenericSchemeWrapper, new web3EventService_1.Web3EventService());
//# sourceMappingURL=genericScheme.js.map