/* eslint-disable */
import Long from "long";
import _m0 from "protobufjs/minimal";
export const protobufPackage = "tendermint.spn.types";
function createBaseMonitoringPacketData() {
    return { monitoringPacket: undefined };
}
export const MonitoringPacketData = {
    encode(message, writer = _m0.Writer.create()) {
        if (message.monitoringPacket !== undefined) {
            MonitoringPacket.encode(message.monitoringPacket, writer.uint32(10).fork()).ldelim();
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseMonitoringPacketData();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.monitoringPacket = MonitoringPacket.decode(reader, reader.uint32());
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        return {
            monitoringPacket: isSet(object.monitoringPacket) ? MonitoringPacket.fromJSON(object.monitoringPacket) : undefined,
        };
    },
    toJSON(message) {
        const obj = {};
        message.monitoringPacket !== undefined && (obj.monitoringPacket = message.monitoringPacket
            ? MonitoringPacket.toJSON(message.monitoringPacket)
            : undefined);
        return obj;
    },
    fromPartial(object) {
        const message = createBaseMonitoringPacketData();
        message.monitoringPacket = (object.monitoringPacket !== undefined && object.monitoringPacket !== null)
            ? MonitoringPacket.fromPartial(object.monitoringPacket)
            : undefined;
        return message;
    },
};
function createBaseMonitoringPacketAck() {
    return {};
}
export const MonitoringPacketAck = {
    encode(_, writer = _m0.Writer.create()) {
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseMonitoringPacketAck();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(_) {
        return {};
    },
    toJSON(_) {
        const obj = {};
        return obj;
    },
    fromPartial(_) {
        const message = createBaseMonitoringPacketAck();
        return message;
    },
};
function createBaseMonitoringPacket() {
    return { blockHeight: 0, signatureCounts: undefined };
}
export const MonitoringPacket = {
    encode(message, writer = _m0.Writer.create()) {
        if (message.blockHeight !== 0) {
            writer.uint32(8).int64(message.blockHeight);
        }
        if (message.signatureCounts !== undefined) {
            SignatureCounts.encode(message.signatureCounts, writer.uint32(18).fork()).ldelim();
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseMonitoringPacket();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.blockHeight = longToNumber(reader.int64());
                    break;
                case 2:
                    message.signatureCounts = SignatureCounts.decode(reader, reader.uint32());
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        return {
            blockHeight: isSet(object.blockHeight) ? Number(object.blockHeight) : 0,
            signatureCounts: isSet(object.signatureCounts) ? SignatureCounts.fromJSON(object.signatureCounts) : undefined,
        };
    },
    toJSON(message) {
        const obj = {};
        message.blockHeight !== undefined && (obj.blockHeight = Math.round(message.blockHeight));
        message.signatureCounts !== undefined
            && (obj.signatureCounts = message.signatureCounts ? SignatureCounts.toJSON(message.signatureCounts) : undefined);
        return obj;
    },
    fromPartial(object) {
        const message = createBaseMonitoringPacket();
        message.blockHeight = object.blockHeight ?? 0;
        message.signatureCounts = (object.signatureCounts !== undefined && object.signatureCounts !== null)
            ? SignatureCounts.fromPartial(object.signatureCounts)
            : undefined;
        return message;
    },
};
function createBaseSignatureCounts() {
    return { blockCount: 0, counts: [] };
}
export const SignatureCounts = {
    encode(message, writer = _m0.Writer.create()) {
        if (message.blockCount !== 0) {
            writer.uint32(8).uint64(message.blockCount);
        }
        for (const v of message.counts) {
            SignatureCount.encode(v, writer.uint32(18).fork()).ldelim();
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseSignatureCounts();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.blockCount = longToNumber(reader.uint64());
                    break;
                case 2:
                    message.counts.push(SignatureCount.decode(reader, reader.uint32()));
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        return {
            blockCount: isSet(object.blockCount) ? Number(object.blockCount) : 0,
            counts: Array.isArray(object?.counts) ? object.counts.map((e) => SignatureCount.fromJSON(e)) : [],
        };
    },
    toJSON(message) {
        const obj = {};
        message.blockCount !== undefined && (obj.blockCount = Math.round(message.blockCount));
        if (message.counts) {
            obj.counts = message.counts.map((e) => e ? SignatureCount.toJSON(e) : undefined);
        }
        else {
            obj.counts = [];
        }
        return obj;
    },
    fromPartial(object) {
        const message = createBaseSignatureCounts();
        message.blockCount = object.blockCount ?? 0;
        message.counts = object.counts?.map((e) => SignatureCount.fromPartial(e)) || [];
        return message;
    },
};
function createBaseSignatureCount() {
    return { opAddress: "", RelativeSignatures: "" };
}
export const SignatureCount = {
    encode(message, writer = _m0.Writer.create()) {
        if (message.opAddress !== "") {
            writer.uint32(10).string(message.opAddress);
        }
        if (message.RelativeSignatures !== "") {
            writer.uint32(18).string(message.RelativeSignatures);
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseSignatureCount();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.opAddress = reader.string();
                    break;
                case 2:
                    message.RelativeSignatures = reader.string();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        return {
            opAddress: isSet(object.opAddress) ? String(object.opAddress) : "",
            RelativeSignatures: isSet(object.RelativeSignatures) ? String(object.RelativeSignatures) : "",
        };
    },
    toJSON(message) {
        const obj = {};
        message.opAddress !== undefined && (obj.opAddress = message.opAddress);
        message.RelativeSignatures !== undefined && (obj.RelativeSignatures = message.RelativeSignatures);
        return obj;
    },
    fromPartial(object) {
        const message = createBaseSignatureCount();
        message.opAddress = object.opAddress ?? "";
        message.RelativeSignatures = object.RelativeSignatures ?? "";
        return message;
    },
};
var globalThis = (() => {
    if (typeof globalThis !== "undefined") {
        return globalThis;
    }
    if (typeof self !== "undefined") {
        return self;
    }
    if (typeof window !== "undefined") {
        return window;
    }
    if (typeof global !== "undefined") {
        return global;
    }
    throw "Unable to locate global object";
})();
function longToNumber(long) {
    if (long.gt(Number.MAX_SAFE_INTEGER)) {
        throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");
    }
    return long.toNumber();
}
if (_m0.util.Long !== Long) {
    _m0.util.Long = Long;
    _m0.configure();
}
function isSet(value) {
    return value !== null && value !== undefined;
}
//# sourceMappingURL=monitoring.js.map