"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.deserializeApoptosisProposalResp = exports.serializeApoptosisProposalResp = exports.cApoptosisProposalRespVersion = void 0;
const Helpers_1 = require("./ajv/Helpers");
const AJVSchemaEnum_1 = require("./enum/AJVSchemaEnum");
const TypeIdentifierEnum_1 = require("./enum/TypeIdentifierEnum");
exports.cApoptosisProposalRespVersion = 1;
function serializeApoptosisProposalResp(stream, obj, root = false) {
    if (root) {
        stream.writeUInt16(TypeIdentifierEnum_1.TypeIdentifierEnum.cApoptosisProposalResp);
    }
    stream.writeUInt8(exports.cApoptosisProposalRespVersion);
    stream.writeString(obj.s);
    stream.writeInt32(obj.r);
}
exports.serializeApoptosisProposalResp = serializeApoptosisProposalResp;
function deserializeApoptosisProposalResp(stream) {
    const version = stream.readUInt8();
    if (version > exports.cApoptosisProposalRespVersion) {
        throw new Error('ApoptosisProposalResp version mismatch');
    }
    const s = stream.readString();
    const r = stream.readInt32();
    const obj = {
        s,
        r,
    };
    const errors = (0, Helpers_1.verifyPayload)(AJVSchemaEnum_1.AJVSchemaEnum.ApoptosisProposalResp, obj);
    if (errors && errors.length > 0) {
        throw new Error('Data validation error');
    }
    return obj;
}
exports.deserializeApoptosisProposalResp = deserializeApoptosisProposalResp;
//# sourceMappingURL=ApoptosisProposalResp.js.map