"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.serializeLostArchiverInvestigateReq = serializeLostArchiverInvestigateReq;
exports.deserializeLostArchiverInvestigateReq = deserializeLostArchiverInvestigateReq;
const TypeIdentifierEnum_1 = require("./enum/TypeIdentifierEnum");
const cLostArchiverInvestigateReqVersion = 1;
function serializeLostArchiverInvestigateReq(stream, obj, root = false) {
    if (root) {
        stream.writeUInt16(TypeIdentifierEnum_1.TypeIdentifierEnum.cLostArchiverInvestigateReq);
    }
    stream.writeUInt8(cLostArchiverInvestigateReqVersion);
    stream.writeString(obj.type);
    stream.writeString(obj.target);
    stream.writeString(obj.investigator);
    stream.writeString(obj.sender);
    stream.writeString(obj.cycle);
    stream.writeString(obj.sign.owner);
    stream.writeString(obj.sign.sig);
}
function deserializeLostArchiverInvestigateReq(stream) {
    const version = stream.readUInt8();
    if (version > cLostArchiverInvestigateReqVersion) {
        throw new Error('cLostArchiverInvestigateReq version mismatch');
    }
    const type = stream.readString();
    if (type !== 'investigate') {
        throw new Error(`Unexpected type value: ${type}`);
    }
    // eslint-disable-next-line prefer-const
    let obj = {
        type: type, // Type assertion to satisfy TypeScript's type system
        target: stream.readString(),
        investigator: stream.readString(),
        sender: stream.readString(),
        cycle: stream.readString(),
        sign: {
            owner: stream.readString(),
            sig: stream.readString(),
        },
    };
    return obj;
}
//# sourceMappingURL=LostArchiverInvestigateReq.js.map