"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.deserializeGlobalAccountReportReq = exports.serializeGlobalAccountReportReq = void 0;
const TypeIdentifierEnum_1 = require("./enum/TypeIdentifierEnum");
const Helpers_1 = require("./ajv/Helpers");
const AJVSchemaEnum_1 = require("./enum/AJVSchemaEnum");
const cGlobalAccountReportReqVersion = 1;
function serializeGlobalAccountReportReq(stream, obj, root = false) {
    if (root) {
        stream.writeUInt16(TypeIdentifierEnum_1.TypeIdentifierEnum.cGlobalAccountReportReq);
    }
    stream.writeUInt8(cGlobalAccountReportReqVersion);
}
exports.serializeGlobalAccountReportReq = serializeGlobalAccountReportReq;
function deserializeGlobalAccountReportReq(stream) {
    const version = stream.readUInt8();
    if (version > cGlobalAccountReportReqVersion) {
        throw new Error('GlobalAccountReportReqSerializable version mismatch');
    }
    const req = {};
    const errors = (0, Helpers_1.verifyPayload)(AJVSchemaEnum_1.AJVSchemaEnum.GlobalAccountReportReq, req);
    if (errors && errors.length > 0) {
        throw new Error('Data validation error');
    }
    return req;
}
exports.deserializeGlobalAccountReportReq = deserializeGlobalAccountReportReq;
//# sourceMappingURL=GlobalAccountReportReq.js.map