"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const commonTypes_1 = require("../commonTypes");
const contractWrapperBase_1 = require("../contractWrapperBase");
const contractWrapperFactory_1 = require("../contractWrapperFactory");
class VoteInOrganizationSchemeWrapper extends contractWrapperBase_1.ContractWrapperBase {
    constructor() {
        super(...arguments);
        this.name = "VoteInOrganizationScheme";
        this.friendlyName = "Vote In Organization Scheme";
        this.factory = exports.VoteInOrganizationSchemeFactory;
        /**
         * Events
         */
        /* tslint:disable:max-line-length */
        this.ProposalExecuted = this.createEventFetcherFactory("ProposalExecuted");
        this.ProposalDeleted = this.createEventFetcherFactory("ProposalDeleted");
        this.VoteOnBehalf = this.createEventFetcherFactory("VoteOnBehalf");
    }
    /* tslint:enable:max-line-length */
    proposeVote(options = {}) {
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            if (!options.avatar) {
                throw new Error("avatar is not defined");
            }
            if (!options.originalIntVote) {
                throw new Error("originalIntVote is not defined");
            }
            if (!options.originalProposalId) {
                throw new Error("originalProposalId is not defined");
            }
            this.logContractFunctionCall("VoteInOrganizationScheme.proposeVote", options);
            const txResult = yield this.wrapTransactionInvocation("VoteInOrganizationScheme.proposeVote", options, () => {
                return this.contract.proposeVote(options.avatar, options.originalIntVote, options.originalProposalId);
            });
            return new contractWrapperBase_1.ArcTransactionProposalResult(txResult.tx);
        });
    }
    setParameters(params) {
        const _super = name => super[name];
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            this.validateStandardSchemeParams(params);
            return _super("_setParameters").call(this, "VoteInOrganizationScheme.setParameters", params.voteParametersHash, params.votingMachineAddress);
        });
    }
    getDefaultPermissions() {
        return commonTypes_1.DefaultSchemePermissions.VoteInOrganizationScheme;
    }
    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 {
                voteParametersHash: params[1],
                votingMachineAddress: params[0],
            };
        });
    }
}
exports.VoteInOrganizationSchemeWrapper = VoteInOrganizationSchemeWrapper;
exports.VoteInOrganizationSchemeFactory = new contractWrapperFactory_1.ContractWrapperFactory("VoteInOrganizationScheme", VoteInOrganizationSchemeWrapper);
//# sourceMappingURL=voteInOrganizationScheme.js.map