"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.deserializeGetAppliedVoteReq = exports.serializeGetAppliedVoteReq = void 0;
const Helpers_1 = require("./ajv/Helpers");
const AJVSchemaEnum_1 = require("./enum/AJVSchemaEnum");
const TypeIdentifierEnum_1 = require("./enum/TypeIdentifierEnum");
const cGetAppliedVoteReqVersion = 1;
function serializeGetAppliedVoteReq(stream, obj, root = false) {
    if (root) {
        stream.writeUInt16(TypeIdentifierEnum_1.TypeIdentifierEnum.cGetAppliedVoteReq);
    }
    stream.writeUInt8(cGetAppliedVoteReqVersion);
    stream.writeString(obj.txId);
}
exports.serializeGetAppliedVoteReq = serializeGetAppliedVoteReq;
function deserializeGetAppliedVoteReq(stream) {
    const version = stream.readUInt8();
    if (version > cGetAppliedVoteReqVersion) {
        throw new Error('GetAppliedVoteReq version mismatch');
    }
    const result = {
        txId: stream.readString(),
    };
    const errors = (0, Helpers_1.verifyPayload)(AJVSchemaEnum_1.AJVSchemaEnum.GetAppliedVoteReq, result);
    if (errors && errors.length > 0) {
        throw new Error(`AJV: validation error -> ${errors.join(', ')}`);
    }
    return result;
}
exports.deserializeGetAppliedVoteReq = deserializeGetAppliedVoteReq;
//# sourceMappingURL=GetAppliedVoteReq.js.map