"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.cGetAccountDataByListReqVersion = void 0;
exports.serializeGetAccountDataByListReq = serializeGetAccountDataByListReq;
exports.deserializeGetAccountDataByListReq = deserializeGetAccountDataByListReq;
const Helpers_1 = require("./ajv/Helpers");
const AJVSchemaEnum_1 = require("./enum/AJVSchemaEnum");
const TypeIdentifierEnum_1 = require("./enum/TypeIdentifierEnum");
exports.cGetAccountDataByListReqVersion = 1;
function serializeGetAccountDataByListReq(stream, obj, root = false) {
    const errors = (0, Helpers_1.verifyPayload)(AJVSchemaEnum_1.AJVSchemaEnum.GetAccountDataByListReq, obj);
    if (errors && errors.length > 0) {
        throw new Error('Data validation error');
    }
    if (root) {
        stream.writeUInt16(TypeIdentifierEnum_1.TypeIdentifierEnum.cGetAccountDataByListReq);
    }
    stream.writeUInt8(exports.cGetAccountDataByListReqVersion);
    stream.writeUInt32(obj.accountIds.length);
    for (const accountId of obj.accountIds) {
        stream.writeString(accountId);
    }
}
function deserializeGetAccountDataByListReq(stream) {
    const version = stream.readUInt8();
    if (version > exports.cGetAccountDataByListReqVersion) {
        throw new Error('GetAccountDataByListReq version mismatch');
    }
    const length = stream.readUInt32();
    const accountIds = [];
    for (let i = 0; i < length; i++) {
        accountIds.push(stream.readString());
    }
    const result = {
        accountIds,
    };
    const errors = (0, Helpers_1.verifyPayload)(AJVSchemaEnum_1.AJVSchemaEnum.GetAccountDataByListReq, result);
    if (errors && errors.length > 0) {
        throw new Error('Data validation error');
    }
    return result;
}
//# sourceMappingURL=GetAccountDataByListReq.js.map