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