// @generated by protobuf-ts 2.9.6
// @generated from protobuf file "stock.proto" (package "api", syntax proto3)
// tslint:disable
import type { BinaryWriteOptions } from "@protobuf-ts/runtime";
import type { IBinaryWriter } from "@protobuf-ts/runtime";
import { WireType } from "@protobuf-ts/runtime";
import type { BinaryReadOptions } from "@protobuf-ts/runtime";
import type { IBinaryReader } from "@protobuf-ts/runtime";
import { UnknownFieldHandler } from "@protobuf-ts/runtime";
import type { PartialMessage } from "@protobuf-ts/runtime";
import { reflectionMergePartial } from "@protobuf-ts/runtime";
import { MessageType } from "@protobuf-ts/runtime";
import { ItemPayload } from "./item";
import { EntityID } from "./shared";
import { EventHeader } from "./shared";
import { QuantityByLV } from "./warehousingShared";
import { QuantityInLV } from "./warehousingShared";
import { StockStatusStruct } from "./warehousingShared";
import { StockMovement } from "./warehousingShared";
import { StockSnapshot } from "./warehousingShared";
import { ActorPayload } from "./actor";
import { EnrichedGoods } from "./warehousingShared";
// 
// This entity represents the quantity of goods physically present into a warehouse.
// 
// The Stock ID.RefID will be built from the Goods 'key' attributes (itemID, LVBranchID, PriorityDate and SegmentationKeys) and the ActorID.
// 
// It means the Stock input events could not be exposed directly to end user, we need to keep it 'behind' other entities in order to being able to build its ID.RefID.
// 
// What about the 'inventory' events... ?? Just a specific case to not expose the ID and build it dynamically from Goods attributes ?
// 
// Because Stock key is based on ItemID, the project must defined its requested items by ID into the order.
// 
// 
// 
// Comments updated 2021/02/17

/**
 * @generated from protobuf message api.StockPayload
 */
export interface StockPayload {
    /**
     * @generated from protobuf field: api.EnrichedGoods Goods = 1 [json_name = "Goods"];
     */
    goods?: EnrichedGoods;
    /**
     * @generated from protobuf field: string ActorID = 2 [json_name = "ActorID"];
     */
    actorID: string;
    /**
     * @generated from protobuf field: api.ActorPayload Actor = 3 [json_name = "Actor"];
     */
    actor?: ActorPayload;
    /**
     * @generated from protobuf field: api.StockSnapshot Snapshot = 4 [json_name = "Snapshot"];
     */
    snapshot?: StockSnapshot; // this struct is managed into preAgg cumulateSnapshotQuantity method
    /**
     * @generated from protobuf field: api.StockMovement Movement = 5 [json_name = "Movement"];
     */
    movement?: StockMovement;
    /**
     * @generated from protobuf field: api.StockStatusStruct Status = 6 [json_name = "Status"];
     */
    status?: StockStatusStruct; // Status field is not accessible from APIs
    /**
     * @generated from protobuf field: api.QuantityInLV QuantityInBaseLV = 7 [json_name = "QuantityInBaseLV"];
     */
    quantityInBaseLV?: QuantityInLV;
    /**
     * @generated from protobuf field: repeated api.QuantityByLV QuantityByLVs = 8 [json_name = "QuantityByLVs"];
     */
    quantityByLVs: QuantityByLV[];
    /**
     * @generated from protobuf field: string LVDetailledQuantity = 9 [json_name = "LVDetailledQuantity"];
     */
    lVDetailledQuantity: string;
    /**
     * @generated from protobuf field: repeated api.StockMovement LatestMovements = 10 [json_name = "LatestMovements"];
     */
    latestMovements: StockMovement[];
    /**
     * Only used for clickhouse extended-stock
     *
     * @generated from protobuf field: double RequestedStockValue = 11 [json_name = "RequestedStockValue"];
     */
    requestedStockValue: number;
    /**
     * Only used for clickhouse extended-stock
     *
     * @generated from protobuf field: double ToReceiveStockValue = 12 [json_name = "ToReceiveStockValue"];
     */
    toReceiveStockValue: number;
    /**
     * Only used for clickhouse extended-stock
     *
     * @generated from protobuf field: string LastUpdateStockDateTime = 13 [json_name = "LastUpdateStockDateTime"];
     */
    lastUpdateStockDateTime: string;
    /**
     * Only used for clickhouse extended-stock
     *
     * @generated from protobuf field: string LastUpdateRequestedDateTime = 14 [json_name = "LastUpdateRequestedDateTime"];
     */
    lastUpdateRequestedDateTime: string;
    /**
     * Only used for clickhouse extended-stock
     *
     * @generated from protobuf field: string LastUpdateToReceiveDateTime = 15 [json_name = "LastUpdateToReceiveDateTime"];
     */
    lastUpdateToReceiveDateTime: string;
}
/**
 *
 * Stock entity Structure
 *
 * @generated from protobuf message api.Stock
 */
export interface Stock {
    /**
     * @generated from protobuf field: api.EventHeader LastEventHeader = 1 [json_name = "LastEventHeader"];
     */
    lastEventHeader?: EventHeader;
    /**
     * @generated from protobuf field: api.EntityID ID = 2 [json_name = "ID"];
     */
    iD?: EntityID;
    /**
     * @generated from protobuf field: api.StockPayload Payload = 3 [json_name = "Payload"];
     */
    payload?: StockPayload;
}
/**
 * @generated from protobuf message api.StockEnrichment
 */
export interface StockEnrichment {
    /**
     * @generated from protobuf field: string ParentEventID = 1 [json_name = "ParentEventID"];
     */
    parentEventID: string;
    /**
     * @generated from protobuf field: string EntityName = 2 [json_name = "EntityName"];
     */
    entityName: string;
    /**
     * @generated from protobuf field: string EntityRefID = 3 [json_name = "EntityRefID"];
     */
    entityRefID: string;
    /**
     * @generated from protobuf field: string RefFilter = 4 [json_name = "RefFilter"];
     */
    refFilter: string;
    /**
     * @generated from protobuf field: string MergePath = 5 [json_name = "MergePath"];
     */
    mergePath: string;
    /**
     * @generated from protobuf oneof: Content
     */
    content: {
        oneofKind: "item";
        /**
         * @generated from protobuf field: api.ItemPayload Item = 10 [json_name = "Item"];
         */
        item: ItemPayload;
    } | {
        oneofKind: "actor";
        /**
         * @generated from protobuf field: api.ActorPayload Actor = 11 [json_name = "Actor"];
         */
        actor: ActorPayload;
    } | {
        oneofKind: undefined;
    };
    /**
     * @generated from protobuf field: string Project = 6 [json_name = "Project"];
     */
    project: string;
    /**
     * @generated from protobuf field: string ParentEntityName = 7 [json_name = "ParentEntityName"];
     */
    parentEntityName: string;
    /**
     * @generated from protobuf field: string ParentEntityID = 8 [json_name = "ParentEntityID"];
     */
    parentEntityID: string;
}
/**
 * @generated from protobuf message api.StockTriplet
 */
export interface StockTriplet {
    /**
     * @generated from protobuf field: api.Stock Current = 1 [json_name = "Current"];
     */
    current?: Stock;
    /**
     * @generated from protobuf field: api.Stock Previous = 2 [json_name = "Previous"];
     */
    previous?: Stock;
    /**
     * @generated from protobuf field: api.Stock LastEvent = 3 [json_name = "LastEvent"];
     */
    lastEvent?: Stock;
}
// @generated message type with reflection information, may provide speed optimized methods
class StockPayload$Type extends MessageType<StockPayload> {
    constructor() {
        super("api.StockPayload", [
            { no: 1, name: "Goods", kind: "message", jsonName: "Goods", T: () => EnrichedGoods },
            { no: 2, name: "ActorID", kind: "scalar", jsonName: "ActorID", T: 9 /*ScalarType.STRING*/, options: { "api.entityRef": "Actor", "api.dataRestrictionKey": "Stock", "api.indexationType": { Types: [{ Context: "*", Type: "generatedText,keyword" }] }, "api.kpiItems": { Items: [{ Context: "Stock", Group: "stock", Queryable: true }, { Context: "Stock", Group: "stock_extended", Queryable: true }] }, "api.viewType": { Types: [{ Context: "*", Type: "shortKeyword" }] } } },
            { no: 3, name: "Actor", kind: "message", jsonName: "Actor", T: () => ActorPayload, options: { "validate.rules": { message: { unauthorized: true } }, "grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field": { readOnly: true }, "api.extractRefExclude": "Stock" } },
            { no: 4, name: "Snapshot", kind: "message", jsonName: "Snapshot", T: () => StockSnapshot, options: { "api.aggSkip": "Snapshotted", "api.kpiExclude": { Items: [{ Context: "Stock", Group: "stock_extended" }] } } },
            { no: 5, name: "Movement", kind: "message", jsonName: "Movement", T: () => StockMovement, options: { "api.aggSkip": "Moved", "api.kpiExclude": { Items: [{ Context: "Stock", Group: "stock_extended" }] } } },
            { no: 6, name: "Status", kind: "message", jsonName: "Status", T: () => StockStatusStruct, options: { "validate.rules": { message: { unauthorized: true } }, "grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field": { readOnly: true }, "api.kpiExclude": { Items: [{ Context: "Stock", Group: "stock_extended" }] } } },
            { no: 7, name: "QuantityInBaseLV", kind: "message", jsonName: "QuantityInBaseLV", T: () => QuantityInLV, options: { "validate.rules": { message: { unauthorized: true } }, "grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field": { readOnly: true } } },
            { no: 8, name: "QuantityByLVs", kind: "message", jsonName: "QuantityByLVs", repeat: 1 /*RepeatType.PACKED*/, T: () => QuantityByLV, options: { "grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field": { readOnly: true }, "api.aggKey": "LVID" } },
            { no: 9, name: "LVDetailledQuantity", kind: "scalar", jsonName: "LVDetailledQuantity", T: 9 /*ScalarType.STRING*/, options: { "grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field": { readOnly: true } } },
            { no: 10, name: "LatestMovements", kind: "message", jsonName: "LatestMovements", repeat: 1 /*RepeatType.PACKED*/, T: () => StockMovement, options: { "grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field": { readOnly: true }, "api.aggKey": "ID", "api.kpiExclude": { Items: [{ Context: "Stock", Group: "stock" }, { Context: "Stock", Group: "stock_extended" }] } } },
            { no: 11, name: "RequestedStockValue", kind: "scalar", jsonName: "RequestedStockValue", T: 1 /*ScalarType.DOUBLE*/, options: { "validate.rules": { double: { unauthorized: true } }, "grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field": { readOnly: true }, "api.kpiItems": { Items: [{ Context: "Stock", Group: "stock_extended", Queryable: true, CustomType: "AggregateFunction(sum,Decimal64(6))" }] } } },
            { no: 12, name: "ToReceiveStockValue", kind: "scalar", jsonName: "ToReceiveStockValue", T: 1 /*ScalarType.DOUBLE*/, options: { "validate.rules": { double: { unauthorized: true } }, "grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field": { readOnly: true }, "api.kpiItems": { Items: [{ Context: "Stock", Group: "stock_extended", Queryable: true, CustomType: "AggregateFunction(sum,Decimal64(6))" }] } } },
            { no: 13, name: "LastUpdateStockDateTime", kind: "scalar", jsonName: "LastUpdateStockDateTime", T: 9 /*ScalarType.STRING*/, options: { "validate.rules": { string: { unauthorized: true } }, "grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field": { readOnly: true }, "api.indexationType": { Types: [{ Context: "Stock", Type: "text" }] }, "api.kpiItems": { Items: [{ Context: "Stock", Group: "stock_extended", CustomType: "SimpleAggregateFunction(max,DateTime)" }] }, "api.viewType": { Types: [{ Context: "*", Type: "date" }] } } },
            { no: 14, name: "LastUpdateRequestedDateTime", kind: "scalar", jsonName: "LastUpdateRequestedDateTime", T: 9 /*ScalarType.STRING*/, options: { "validate.rules": { string: { unauthorized: true } }, "grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field": { readOnly: true }, "api.indexationType": { Types: [{ Context: "Stock", Type: "text" }] }, "api.kpiItems": { Items: [{ Context: "Stock", Group: "stock_extended", CustomType: "SimpleAggregateFunction(max,DateTime)" }] }, "api.viewType": { Types: [{ Context: "*", Type: "date" }] } } },
            { no: 15, name: "LastUpdateToReceiveDateTime", kind: "scalar", jsonName: "LastUpdateToReceiveDateTime", T: 9 /*ScalarType.STRING*/, options: { "validate.rules": { string: { unauthorized: true } }, "grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field": { readOnly: true }, "api.indexationType": { Types: [{ Context: "Stock", Type: "text" }] }, "api.kpiItems": { Items: [{ Context: "Stock", Group: "stock_extended", CustomType: "SimpleAggregateFunction(max,DateTime)" }] }, "api.viewType": { Types: [{ Context: "*", Type: "date" }] } } }
        ]);
    }
    create(value?: PartialMessage<StockPayload>): StockPayload {
        const message = globalThis.Object.create((this.messagePrototype!));
        message.actorID = "";
        message.quantityByLVs = [];
        message.lVDetailledQuantity = "";
        message.latestMovements = [];
        message.requestedStockValue = 0;
        message.toReceiveStockValue = 0;
        message.lastUpdateStockDateTime = "";
        message.lastUpdateRequestedDateTime = "";
        message.lastUpdateToReceiveDateTime = "";
        if (value !== undefined)
            reflectionMergePartial<StockPayload>(this, message, value);
        return message;
    }
    internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: StockPayload): StockPayload {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* api.EnrichedGoods Goods = 1 [json_name = "Goods"];*/ 1:
                    message.goods = EnrichedGoods.internalBinaryRead(reader, reader.uint32(), options, message.goods);
                    break;
                case /* string ActorID = 2 [json_name = "ActorID"];*/ 2:
                    message.actorID = reader.string();
                    break;
                case /* api.ActorPayload Actor = 3 [json_name = "Actor"];*/ 3:
                    message.actor = ActorPayload.internalBinaryRead(reader, reader.uint32(), options, message.actor);
                    break;
                case /* api.StockSnapshot Snapshot = 4 [json_name = "Snapshot"];*/ 4:
                    message.snapshot = StockSnapshot.internalBinaryRead(reader, reader.uint32(), options, message.snapshot);
                    break;
                case /* api.StockMovement Movement = 5 [json_name = "Movement"];*/ 5:
                    message.movement = StockMovement.internalBinaryRead(reader, reader.uint32(), options, message.movement);
                    break;
                case /* api.StockStatusStruct Status = 6 [json_name = "Status"];*/ 6:
                    message.status = StockStatusStruct.internalBinaryRead(reader, reader.uint32(), options, message.status);
                    break;
                case /* api.QuantityInLV QuantityInBaseLV = 7 [json_name = "QuantityInBaseLV"];*/ 7:
                    message.quantityInBaseLV = QuantityInLV.internalBinaryRead(reader, reader.uint32(), options, message.quantityInBaseLV);
                    break;
                case /* repeated api.QuantityByLV QuantityByLVs = 8 [json_name = "QuantityByLVs"];*/ 8:
                    message.quantityByLVs.push(QuantityByLV.internalBinaryRead(reader, reader.uint32(), options));
                    break;
                case /* string LVDetailledQuantity = 9 [json_name = "LVDetailledQuantity"];*/ 9:
                    message.lVDetailledQuantity = reader.string();
                    break;
                case /* repeated api.StockMovement LatestMovements = 10 [json_name = "LatestMovements"];*/ 10:
                    message.latestMovements.push(StockMovement.internalBinaryRead(reader, reader.uint32(), options));
                    break;
                case /* double RequestedStockValue = 11 [json_name = "RequestedStockValue"];*/ 11:
                    message.requestedStockValue = reader.double();
                    break;
                case /* double ToReceiveStockValue = 12 [json_name = "ToReceiveStockValue"];*/ 12:
                    message.toReceiveStockValue = reader.double();
                    break;
                case /* string LastUpdateStockDateTime = 13 [json_name = "LastUpdateStockDateTime"];*/ 13:
                    message.lastUpdateStockDateTime = reader.string();
                    break;
                case /* string LastUpdateRequestedDateTime = 14 [json_name = "LastUpdateRequestedDateTime"];*/ 14:
                    message.lastUpdateRequestedDateTime = reader.string();
                    break;
                case /* string LastUpdateToReceiveDateTime = 15 [json_name = "LastUpdateToReceiveDateTime"];*/ 15:
                    message.lastUpdateToReceiveDateTime = reader.string();
                    break;
                default:
                    let u = options.readUnknownField;
                    if (u === "throw")
                        throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
                    let d = reader.skip(wireType);
                    if (u !== false)
                        (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
            }
        }
        return message;
    }
    internalBinaryWrite(message: StockPayload, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
        /* api.EnrichedGoods Goods = 1 [json_name = "Goods"]; */
        if (message.goods)
            EnrichedGoods.internalBinaryWrite(message.goods, writer.tag(1, WireType.LengthDelimited).fork(), options).join();
        /* string ActorID = 2 [json_name = "ActorID"]; */
        if (message.actorID !== "")
            writer.tag(2, WireType.LengthDelimited).string(message.actorID);
        /* api.ActorPayload Actor = 3 [json_name = "Actor"]; */
        if (message.actor)
            ActorPayload.internalBinaryWrite(message.actor, writer.tag(3, WireType.LengthDelimited).fork(), options).join();
        /* api.StockSnapshot Snapshot = 4 [json_name = "Snapshot"]; */
        if (message.snapshot)
            StockSnapshot.internalBinaryWrite(message.snapshot, writer.tag(4, WireType.LengthDelimited).fork(), options).join();
        /* api.StockMovement Movement = 5 [json_name = "Movement"]; */
        if (message.movement)
            StockMovement.internalBinaryWrite(message.movement, writer.tag(5, WireType.LengthDelimited).fork(), options).join();
        /* api.StockStatusStruct Status = 6 [json_name = "Status"]; */
        if (message.status)
            StockStatusStruct.internalBinaryWrite(message.status, writer.tag(6, WireType.LengthDelimited).fork(), options).join();
        /* api.QuantityInLV QuantityInBaseLV = 7 [json_name = "QuantityInBaseLV"]; */
        if (message.quantityInBaseLV)
            QuantityInLV.internalBinaryWrite(message.quantityInBaseLV, writer.tag(7, WireType.LengthDelimited).fork(), options).join();
        /* repeated api.QuantityByLV QuantityByLVs = 8 [json_name = "QuantityByLVs"]; */
        for (let i = 0; i < message.quantityByLVs.length; i++)
            QuantityByLV.internalBinaryWrite(message.quantityByLVs[i], writer.tag(8, WireType.LengthDelimited).fork(), options).join();
        /* string LVDetailledQuantity = 9 [json_name = "LVDetailledQuantity"]; */
        if (message.lVDetailledQuantity !== "")
            writer.tag(9, WireType.LengthDelimited).string(message.lVDetailledQuantity);
        /* repeated api.StockMovement LatestMovements = 10 [json_name = "LatestMovements"]; */
        for (let i = 0; i < message.latestMovements.length; i++)
            StockMovement.internalBinaryWrite(message.latestMovements[i], writer.tag(10, WireType.LengthDelimited).fork(), options).join();
        /* double RequestedStockValue = 11 [json_name = "RequestedStockValue"]; */
        if (message.requestedStockValue !== 0)
            writer.tag(11, WireType.Bit64).double(message.requestedStockValue);
        /* double ToReceiveStockValue = 12 [json_name = "ToReceiveStockValue"]; */
        if (message.toReceiveStockValue !== 0)
            writer.tag(12, WireType.Bit64).double(message.toReceiveStockValue);
        /* string LastUpdateStockDateTime = 13 [json_name = "LastUpdateStockDateTime"]; */
        if (message.lastUpdateStockDateTime !== "")
            writer.tag(13, WireType.LengthDelimited).string(message.lastUpdateStockDateTime);
        /* string LastUpdateRequestedDateTime = 14 [json_name = "LastUpdateRequestedDateTime"]; */
        if (message.lastUpdateRequestedDateTime !== "")
            writer.tag(14, WireType.LengthDelimited).string(message.lastUpdateRequestedDateTime);
        /* string LastUpdateToReceiveDateTime = 15 [json_name = "LastUpdateToReceiveDateTime"]; */
        if (message.lastUpdateToReceiveDateTime !== "")
            writer.tag(15, WireType.LengthDelimited).string(message.lastUpdateToReceiveDateTime);
        let u = options.writeUnknownFields;
        if (u !== false)
            (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
        return writer;
    }
}
/**
 * @generated MessageType for protobuf message api.StockPayload
 */
export const StockPayload = new StockPayload$Type();
// @generated message type with reflection information, may provide speed optimized methods
class Stock$Type extends MessageType<Stock> {
    constructor() {
        super("api.Stock", [
            { no: 1, name: "LastEventHeader", kind: "message", jsonName: "LastEventHeader", T: () => EventHeader },
            { no: 2, name: "ID", kind: "message", jsonName: "ID", T: () => EntityID },
            { no: 3, name: "Payload", kind: "message", jsonName: "Payload", T: () => StockPayload }
        ]);
    }
    create(value?: PartialMessage<Stock>): Stock {
        const message = globalThis.Object.create((this.messagePrototype!));
        if (value !== undefined)
            reflectionMergePartial<Stock>(this, message, value);
        return message;
    }
    internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: Stock): Stock {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* api.EventHeader LastEventHeader = 1 [json_name = "LastEventHeader"];*/ 1:
                    message.lastEventHeader = EventHeader.internalBinaryRead(reader, reader.uint32(), options, message.lastEventHeader);
                    break;
                case /* api.EntityID ID = 2 [json_name = "ID"];*/ 2:
                    message.iD = EntityID.internalBinaryRead(reader, reader.uint32(), options, message.iD);
                    break;
                case /* api.StockPayload Payload = 3 [json_name = "Payload"];*/ 3:
                    message.payload = StockPayload.internalBinaryRead(reader, reader.uint32(), options, message.payload);
                    break;
                default:
                    let u = options.readUnknownField;
                    if (u === "throw")
                        throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
                    let d = reader.skip(wireType);
                    if (u !== false)
                        (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
            }
        }
        return message;
    }
    internalBinaryWrite(message: Stock, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
        /* api.EventHeader LastEventHeader = 1 [json_name = "LastEventHeader"]; */
        if (message.lastEventHeader)
            EventHeader.internalBinaryWrite(message.lastEventHeader, writer.tag(1, WireType.LengthDelimited).fork(), options).join();
        /* api.EntityID ID = 2 [json_name = "ID"]; */
        if (message.iD)
            EntityID.internalBinaryWrite(message.iD, writer.tag(2, WireType.LengthDelimited).fork(), options).join();
        /* api.StockPayload Payload = 3 [json_name = "Payload"]; */
        if (message.payload)
            StockPayload.internalBinaryWrite(message.payload, writer.tag(3, WireType.LengthDelimited).fork(), options).join();
        let u = options.writeUnknownFields;
        if (u !== false)
            (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
        return writer;
    }
}
/**
 * @generated MessageType for protobuf message api.Stock
 */
export const Stock = new Stock$Type();
// @generated message type with reflection information, may provide speed optimized methods
class StockEnrichment$Type extends MessageType<StockEnrichment> {
    constructor() {
        super("api.StockEnrichment", [
            { no: 1, name: "ParentEventID", kind: "scalar", jsonName: "ParentEventID", T: 9 /*ScalarType.STRING*/ },
            { no: 2, name: "EntityName", kind: "scalar", jsonName: "EntityName", T: 9 /*ScalarType.STRING*/ },
            { no: 3, name: "EntityRefID", kind: "scalar", jsonName: "EntityRefID", T: 9 /*ScalarType.STRING*/ },
            { no: 4, name: "RefFilter", kind: "scalar", jsonName: "RefFilter", T: 9 /*ScalarType.STRING*/ },
            { no: 5, name: "MergePath", kind: "scalar", jsonName: "MergePath", T: 9 /*ScalarType.STRING*/ },
            { no: 10, name: "Item", kind: "message", jsonName: "Item", oneof: "content", T: () => ItemPayload },
            { no: 11, name: "Actor", kind: "message", jsonName: "Actor", oneof: "content", T: () => ActorPayload },
            { no: 6, name: "Project", kind: "scalar", jsonName: "Project", T: 9 /*ScalarType.STRING*/ },
            { no: 7, name: "ParentEntityName", kind: "scalar", jsonName: "ParentEntityName", T: 9 /*ScalarType.STRING*/ },
            { no: 8, name: "ParentEntityID", kind: "scalar", jsonName: "ParentEntityID", T: 9 /*ScalarType.STRING*/ }
        ]);
    }
    create(value?: PartialMessage<StockEnrichment>): StockEnrichment {
        const message = globalThis.Object.create((this.messagePrototype!));
        message.parentEventID = "";
        message.entityName = "";
        message.entityRefID = "";
        message.refFilter = "";
        message.mergePath = "";
        message.content = { oneofKind: undefined };
        message.project = "";
        message.parentEntityName = "";
        message.parentEntityID = "";
        if (value !== undefined)
            reflectionMergePartial<StockEnrichment>(this, message, value);
        return message;
    }
    internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: StockEnrichment): StockEnrichment {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* string ParentEventID = 1 [json_name = "ParentEventID"];*/ 1:
                    message.parentEventID = reader.string();
                    break;
                case /* string EntityName = 2 [json_name = "EntityName"];*/ 2:
                    message.entityName = reader.string();
                    break;
                case /* string EntityRefID = 3 [json_name = "EntityRefID"];*/ 3:
                    message.entityRefID = reader.string();
                    break;
                case /* string RefFilter = 4 [json_name = "RefFilter"];*/ 4:
                    message.refFilter = reader.string();
                    break;
                case /* string MergePath = 5 [json_name = "MergePath"];*/ 5:
                    message.mergePath = reader.string();
                    break;
                case /* api.ItemPayload Item = 10 [json_name = "Item"];*/ 10:
                    message.content = {
                        oneofKind: "item",
                        item: ItemPayload.internalBinaryRead(reader, reader.uint32(), options, (message.content as any).item)
                    };
                    break;
                case /* api.ActorPayload Actor = 11 [json_name = "Actor"];*/ 11:
                    message.content = {
                        oneofKind: "actor",
                        actor: ActorPayload.internalBinaryRead(reader, reader.uint32(), options, (message.content as any).actor)
                    };
                    break;
                case /* string Project = 6 [json_name = "Project"];*/ 6:
                    message.project = reader.string();
                    break;
                case /* string ParentEntityName = 7 [json_name = "ParentEntityName"];*/ 7:
                    message.parentEntityName = reader.string();
                    break;
                case /* string ParentEntityID = 8 [json_name = "ParentEntityID"];*/ 8:
                    message.parentEntityID = reader.string();
                    break;
                default:
                    let u = options.readUnknownField;
                    if (u === "throw")
                        throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
                    let d = reader.skip(wireType);
                    if (u !== false)
                        (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
            }
        }
        return message;
    }
    internalBinaryWrite(message: StockEnrichment, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
        /* string ParentEventID = 1 [json_name = "ParentEventID"]; */
        if (message.parentEventID !== "")
            writer.tag(1, WireType.LengthDelimited).string(message.parentEventID);
        /* string EntityName = 2 [json_name = "EntityName"]; */
        if (message.entityName !== "")
            writer.tag(2, WireType.LengthDelimited).string(message.entityName);
        /* string EntityRefID = 3 [json_name = "EntityRefID"]; */
        if (message.entityRefID !== "")
            writer.tag(3, WireType.LengthDelimited).string(message.entityRefID);
        /* string RefFilter = 4 [json_name = "RefFilter"]; */
        if (message.refFilter !== "")
            writer.tag(4, WireType.LengthDelimited).string(message.refFilter);
        /* string MergePath = 5 [json_name = "MergePath"]; */
        if (message.mergePath !== "")
            writer.tag(5, WireType.LengthDelimited).string(message.mergePath);
        /* api.ItemPayload Item = 10 [json_name = "Item"]; */
        if (message.content.oneofKind === "item")
            ItemPayload.internalBinaryWrite(message.content.item, writer.tag(10, WireType.LengthDelimited).fork(), options).join();
        /* api.ActorPayload Actor = 11 [json_name = "Actor"]; */
        if (message.content.oneofKind === "actor")
            ActorPayload.internalBinaryWrite(message.content.actor, writer.tag(11, WireType.LengthDelimited).fork(), options).join();
        /* string Project = 6 [json_name = "Project"]; */
        if (message.project !== "")
            writer.tag(6, WireType.LengthDelimited).string(message.project);
        /* string ParentEntityName = 7 [json_name = "ParentEntityName"]; */
        if (message.parentEntityName !== "")
            writer.tag(7, WireType.LengthDelimited).string(message.parentEntityName);
        /* string ParentEntityID = 8 [json_name = "ParentEntityID"]; */
        if (message.parentEntityID !== "")
            writer.tag(8, WireType.LengthDelimited).string(message.parentEntityID);
        let u = options.writeUnknownFields;
        if (u !== false)
            (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
        return writer;
    }
}
/**
 * @generated MessageType for protobuf message api.StockEnrichment
 */
export const StockEnrichment = new StockEnrichment$Type();
// @generated message type with reflection information, may provide speed optimized methods
class StockTriplet$Type extends MessageType<StockTriplet> {
    constructor() {
        super("api.StockTriplet", [
            { no: 1, name: "Current", kind: "message", jsonName: "Current", T: () => Stock },
            { no: 2, name: "Previous", kind: "message", jsonName: "Previous", T: () => Stock },
            { no: 3, name: "LastEvent", kind: "message", jsonName: "LastEvent", T: () => Stock }
        ]);
    }
    create(value?: PartialMessage<StockTriplet>): StockTriplet {
        const message = globalThis.Object.create((this.messagePrototype!));
        if (value !== undefined)
            reflectionMergePartial<StockTriplet>(this, message, value);
        return message;
    }
    internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: StockTriplet): StockTriplet {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* api.Stock Current = 1 [json_name = "Current"];*/ 1:
                    message.current = Stock.internalBinaryRead(reader, reader.uint32(), options, message.current);
                    break;
                case /* api.Stock Previous = 2 [json_name = "Previous"];*/ 2:
                    message.previous = Stock.internalBinaryRead(reader, reader.uint32(), options, message.previous);
                    break;
                case /* api.Stock LastEvent = 3 [json_name = "LastEvent"];*/ 3:
                    message.lastEvent = Stock.internalBinaryRead(reader, reader.uint32(), options, message.lastEvent);
                    break;
                default:
                    let u = options.readUnknownField;
                    if (u === "throw")
                        throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
                    let d = reader.skip(wireType);
                    if (u !== false)
                        (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
            }
        }
        return message;
    }
    internalBinaryWrite(message: StockTriplet, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
        /* api.Stock Current = 1 [json_name = "Current"]; */
        if (message.current)
            Stock.internalBinaryWrite(message.current, writer.tag(1, WireType.LengthDelimited).fork(), options).join();
        /* api.Stock Previous = 2 [json_name = "Previous"]; */
        if (message.previous)
            Stock.internalBinaryWrite(message.previous, writer.tag(2, WireType.LengthDelimited).fork(), options).join();
        /* api.Stock LastEvent = 3 [json_name = "LastEvent"]; */
        if (message.lastEvent)
            Stock.internalBinaryWrite(message.lastEvent, writer.tag(3, WireType.LengthDelimited).fork(), options).join();
        let u = options.writeUnknownFields;
        if (u !== false)
            (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
        return writer;
    }
}
/**
 * @generated MessageType for protobuf message api.StockTriplet
 */
export const StockTriplet = new StockTriplet$Type();
