"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    var desc = Object.getOwnPropertyDescriptor(m, k);
    if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
      desc = { enumerable: true, get: function() { return m[k]; } };
    }
    Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
    Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
    o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
    var ownKeys = function(o) {
        ownKeys = Object.getOwnPropertyNames || function (o) {
            var ar = [];
            for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
            return ar;
        };
        return ownKeys(o);
    };
    return function (mod) {
        if (mod && mod.__esModule) return mod;
        var result = {};
        if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
        __setModuleDefault(result, mod);
        return result;
    };
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.StagedFinalizeBlockEvent = void 0;
const query_1 = require("./query");
const streaming_1 = require("../subaccounts/streaming");
const streaming_2 = require("../prices/streaming");
const _m0 = __importStar(require("protobufjs/minimal"));
function createBaseStagedFinalizeBlockEvent() {
    return {
        orderFill: undefined,
        subaccountUpdate: undefined,
        orderbookUpdate: undefined,
        priceUpdate: undefined
    };
}
exports.StagedFinalizeBlockEvent = {
    encode(message, writer = _m0.Writer.create()) {
        if (message.orderFill !== undefined) {
            query_1.StreamOrderbookFill.encode(message.orderFill, writer.uint32(10).fork()).ldelim();
        }
        if (message.subaccountUpdate !== undefined) {
            streaming_1.StreamSubaccountUpdate.encode(message.subaccountUpdate, writer.uint32(18).fork()).ldelim();
        }
        if (message.orderbookUpdate !== undefined) {
            query_1.StreamOrderbookUpdate.encode(message.orderbookUpdate, writer.uint32(26).fork()).ldelim();
        }
        if (message.priceUpdate !== undefined) {
            streaming_2.StreamPriceUpdate.encode(message.priceUpdate, writer.uint32(34).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 = createBaseStagedFinalizeBlockEvent();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.orderFill = query_1.StreamOrderbookFill.decode(reader, reader.uint32());
                    break;
                case 2:
                    message.subaccountUpdate = streaming_1.StreamSubaccountUpdate.decode(reader, reader.uint32());
                    break;
                case 3:
                    message.orderbookUpdate = query_1.StreamOrderbookUpdate.decode(reader, reader.uint32());
                    break;
                case 4:
                    message.priceUpdate = streaming_2.StreamPriceUpdate.decode(reader, reader.uint32());
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromPartial(object) {
        const message = createBaseStagedFinalizeBlockEvent();
        message.orderFill = object.orderFill !== undefined && object.orderFill !== null ? query_1.StreamOrderbookFill.fromPartial(object.orderFill) : undefined;
        message.subaccountUpdate = object.subaccountUpdate !== undefined && object.subaccountUpdate !== null ? streaming_1.StreamSubaccountUpdate.fromPartial(object.subaccountUpdate) : undefined;
        message.orderbookUpdate = object.orderbookUpdate !== undefined && object.orderbookUpdate !== null ? query_1.StreamOrderbookUpdate.fromPartial(object.orderbookUpdate) : undefined;
        message.priceUpdate = object.priceUpdate !== undefined && object.priceUpdate !== null ? streaming_2.StreamPriceUpdate.fromPartial(object.priceUpdate) : undefined;
        return message;
    }
};
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3RyZWFtaW5nLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vLi4vLi4vLi4vbm9kZV9tb2R1bGVzL0ByaXRiaXQvdjQtcHJvdG8v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