// @generated by protobuf-ts 2.9.6
// @generated from protobuf file "handlingunit.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 { ETA } from "./tradeShared";
import { ClaimSummary } from "./shared";
import { AttachmentSummary } from "./shared";
import { DateTime } from "./shared";
import { QuantifiedDatedGoodsByExeflow } from "./warehousingShared";
import { QuantifiedGoodsByExeflow } from "./warehousingShared";
import { HandlingunitStatusStruct } from "./warehousingShared";
import { MetadataElement } from "./shared";
import { TrackingSummary } from "./transportShared";
import { HandlingunitInformation } from "./warehousingShared";
// 
// This entity represents the content of a logisticUnit and its links to the corresponding executionFlows.
// (a logisticUnit may contain goods from many ExecutionFlows).
// 
// A Handlingunit may contain simultaneously Goods and other Handlingunits.
// 
// When a Handlingunit contains Goods, the reference to an ExecutionFlow & LineID is mandatory
// 
// A Handlingunit is composed of :
// - general information about the Handlingunit. (type, dimensions, weight)
// - boolean to describe if it contains other HUs
// - boolean to describe if it contains some Goods
// - List of Goods included (for each Goods, with reference to ExecutionFlow, lineID and quantity)
// - List of Goods received (for each Goods, with reference to ExecutionFlow, lineID and quantity)
// - List of other HandlingUnits included (only the refID)
// - Tracking summary, coming from the tracking entity.
// - Metadata  ()
// - ETA received from Tracking
// - ETA sent directly on HU
// 
// 
// Comments updated 2024/01/09

/**
 * @generated from protobuf message api.HandlingunitPayload
 */
export interface HandlingunitPayload {
    /**
     * @generated from protobuf field: api.HandlingunitInformation Information = 1 [json_name = "Information"];
     */
    information?: HandlingunitInformation;
    /**
     * @generated from protobuf field: bool ContainsGoods = 2 [json_name = "ContainsGoods"];
     */
    containsGoods: boolean;
    /**
     * @generated from protobuf field: bool ContainsHUs = 3 [json_name = "ContainsHUs"];
     */
    containsHUs: boolean;
    /**
     * @generated from protobuf field: repeated string IncludedHandlingunitIDs = 4 [json_name = "IncludedHandlingunitIDs"];
     */
    includedHandlingunitIDs: string[];
    /**
     * @generated from protobuf field: api.TrackingSummary CurrentTrackingSummary = 5 [json_name = "CurrentTrackingSummary"];
     */
    currentTrackingSummary?: TrackingSummary;
    /**
     * Metadata are characteristics specific to the project. They can be of several data form (string, integer, float, boolean or timestamp)
     *
     * @generated from protobuf field: repeated api.MetadataElement MetaData = 6 [json_name = "MetaData"];
     */
    metaData: MetadataElement[];
    /**
     * @generated from protobuf field: api.HandlingunitStatusStruct Status = 7 [json_name = "Status"];
     */
    status?: HandlingunitStatusStruct; // Status field is not accessible from APIs
    /**
     * @generated from protobuf field: repeated api.QuantifiedGoodsByExeflow PreparedContents = 8 [json_name = "PreparedContents"];
     */
    preparedContents: QuantifiedGoodsByExeflow[];
    /**
     * @generated from protobuf field: repeated api.QuantifiedDatedGoodsByExeflow ReceivedContents = 9 [json_name = "ReceivedContents"];
     */
    receivedContents: QuantifiedDatedGoodsByExeflow[];
    /**
     * @generated from protobuf field: api.DateTime DispatchedDateTime = 10 [json_name = "DispatchedDateTime"];
     */
    dispatchedDateTime?: DateTime;
    /**
     * @generated from protobuf field: repeated string TrackingIDs = 11 [json_name = "TrackingIDs"];
     */
    trackingIDs: string[];
    /**
     * @generated from protobuf field: repeated api.AttachmentSummary Attachments = 12 [json_name = "Attachments"];
     */
    attachments: AttachmentSummary[];
    /**
     * @generated from protobuf field: int32 AttachmentNumber = 13 [json_name = "AttachmentNumber"];
     */
    attachmentNumber: number;
    /**
     * @generated from protobuf field: repeated api.ClaimSummary Claims = 14 [json_name = "Claims"];
     */
    claims: ClaimSummary[];
    /**
     * @generated from protobuf field: int32 ClaimNumber = 15 [json_name = "ClaimNumber"];
     */
    claimNumber: number;
    /**
     * @generated from protobuf field: api.ETA HandlingunitETA = 16 [json_name = "HandlingunitETA"];
     */
    handlingunitETA?: ETA;
    /**
     * @generated from protobuf field: api.ETA TrackingETA = 17 [json_name = "TrackingETA"];
     */
    trackingETA?: ETA;
    /**
     * @generated from protobuf field: string ParentHU = 18 [json_name = "ParentHU"];
     */
    parentHU: string;
}
// 
// 	Handlingunit entity structure

/**
 * @generated from protobuf message api.Handlingunit
 */
export interface Handlingunit {
    /**
     * @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.HandlingunitPayload Payload = 3 [json_name = "Payload"];
     */
    payload?: HandlingunitPayload;
}
// Handlingunit Enrichment

/**
 * @generated from protobuf message api.HandlingunitEnrichment
 */
export interface HandlingunitEnrichment {
    /**
     * @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: 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.HandlingunitTriplet
 */
export interface HandlingunitTriplet {
    /**
     * @generated from protobuf field: api.Handlingunit Current = 1 [json_name = "Current"];
     */
    current?: Handlingunit;
    /**
     * @generated from protobuf field: api.Handlingunit Previous = 2 [json_name = "Previous"];
     */
    previous?: Handlingunit;
    /**
     * @generated from protobuf field: api.Handlingunit LastEvent = 3 [json_name = "LastEvent"];
     */
    lastEvent?: Handlingunit;
}
// @generated message type with reflection information, may provide speed optimized methods
class HandlingunitPayload$Type extends MessageType<HandlingunitPayload> {
    constructor() {
        super("api.HandlingunitPayload", [
            { no: 1, name: "Information", kind: "message", jsonName: "Information", T: () => HandlingunitInformation },
            { no: 2, name: "ContainsGoods", kind: "scalar", jsonName: "ContainsGoods", T: 8 /*ScalarType.BOOL*/, options: { "api.dataRestrictionKey": "Handlingunit", "api.kpiItems": { Items: [{ Context: "Handlingunit", Group: "handlingunit", Queryable: true }] } } },
            { no: 3, name: "ContainsHUs", kind: "scalar", jsonName: "ContainsHUs", T: 8 /*ScalarType.BOOL*/, options: { "api.dataRestrictionKey": "Handlingunit", "api.kpiItems": { Items: [{ Context: "Handlingunit", Group: "handlingunit", Queryable: true }] } } },
            { no: 4, name: "IncludedHandlingunitIDs", kind: "scalar", jsonName: "IncludedHandlingunitIDs", repeat: 2 /*RepeatType.UNPACKED*/, T: 9 /*ScalarType.STRING*/, options: { "api.kpiExclude": { Items: [{ Context: "Handlingunit", Group: "handlingunit" }] }, "api.aggAppend": "HUsAdded", "api.indexationType": { Types: [{ Context: "*", Type: "generatedText,keyword" }] }, "api.viewType": { Types: [{ Context: "*", Type: "shortKeyword" }] } } },
            { no: 5, name: "CurrentTrackingSummary", kind: "message", jsonName: "CurrentTrackingSummary", T: () => TrackingSummary, options: { "api.aggSkip": "TrackingUpdated" } },
            { no: 6, name: "MetaData", kind: "message", jsonName: "MetaData", repeat: 1 /*RepeatType.PACKED*/, T: () => MetadataElement, options: { "grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field": { description: "Metadata are characteristics specific to the project. They can be of several data form (string, integer, float, boolean or timestamp)" }, "api.metadata": true, "api.aggKey": "Key", "api.parentEntity": "Handlingunit", "api.aggAppend": "HUsAdded,MetaDataUpdated,GoodsPrepared" } },
            { no: 7, name: "Status", kind: "message", jsonName: "Status", T: () => HandlingunitStatusStruct, options: { "validate.rules": { message: { unauthorized: true } }, "grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field": { readOnly: true } } },
            { no: 8, name: "PreparedContents", kind: "message", jsonName: "PreparedContents", repeat: 1 /*RepeatType.PACKED*/, T: () => QuantifiedGoodsByExeflow, options: { "api.kpiExclude": { Items: [{ Context: "Handlingunit", Group: "handlingunit" }] }, "api.aggAppend": "GoodsPrepared" } },
            { no: 9, name: "ReceivedContents", kind: "message", jsonName: "ReceivedContents", repeat: 1 /*RepeatType.PACKED*/, T: () => QuantifiedDatedGoodsByExeflow, options: { "api.kpiExclude": { Items: [{ Context: "Handlingunit", Group: "handlingunit" }] }, "api.aggAppend": "GoodsReceived" } },
            { no: 10, name: "DispatchedDateTime", kind: "message", jsonName: "DispatchedDateTime", T: () => DateTime, options: { "api.aggSkip": "TrackingUpdated", "api.kpiExclude": { Items: [{ Context: "Handlingunit", Group: "handlingunit" }] } } },
            { no: 11, name: "TrackingIDs", kind: "scalar", jsonName: "TrackingIDs", repeat: 2 /*RepeatType.UNPACKED*/, T: 9 /*ScalarType.STRING*/, options: { "api.aggAppend": "TrackingUpdated", "api.indexationType": { Types: [{ Context: "*", Type: "generatedText,keyword" }] }, "api.viewType": { Types: [{ Context: "*", Type: "shortKeyword" }] } } },
            { no: 12, name: "Attachments", kind: "message", jsonName: "Attachments", repeat: 1 /*RepeatType.PACKED*/, T: () => AttachmentSummary, options: { "grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field": { description: "Number of attachments per type" }, "api.aggSkip": "AttachmentAdded,AttachmentRemoved" } },
            { no: 13, name: "AttachmentNumber", kind: "scalar", jsonName: "AttachmentNumber", T: 5 /*ScalarType.INT32*/, options: { "grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field": { description: "Total number of attachments" } } },
            { no: 14, name: "Claims", kind: "message", jsonName: "Claims", repeat: 1 /*RepeatType.PACKED*/, T: () => ClaimSummary, options: { "grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field": { description: "Number of claims per type" }, "api.aggKey": "ClaimTypeID", "api.aggSkip": "ClaimAdded" } },
            { no: 15, name: "ClaimNumber", kind: "scalar", jsonName: "ClaimNumber", T: 5 /*ScalarType.INT32*/, options: { "grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field": { description: "Total number of claims" } } },
            { no: 16, name: "HandlingunitETA", kind: "message", jsonName: "HandlingunitETA", T: () => ETA, options: { "grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field": { description: "Estimated Time of Arrival for the HandlingUnit" }, "api.aggSkip": "ETAUpdated" } },
            { no: 17, name: "TrackingETA", kind: "message", jsonName: "TrackingETA", T: () => ETA, options: { "grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field": { description: "Estimated Time of Arrival for the HandlingUnit received from Tracking" }, "api.aggSkip": "TrackingETAUpdated", "api.kpiExclude": { Items: [{ Context: "Handlingunit", Group: "handlingunit" }] } } },
            { no: 18, name: "ParentHU", kind: "scalar", jsonName: "ParentHU", T: 9 /*ScalarType.STRING*/, options: { "grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field": { description: "HU parent for this HU" } } }
        ]);
    }
    create(value?: PartialMessage<HandlingunitPayload>): HandlingunitPayload {
        const message = globalThis.Object.create((this.messagePrototype!));
        message.containsGoods = false;
        message.containsHUs = false;
        message.includedHandlingunitIDs = [];
        message.metaData = [];
        message.preparedContents = [];
        message.receivedContents = [];
        message.trackingIDs = [];
        message.attachments = [];
        message.attachmentNumber = 0;
        message.claims = [];
        message.claimNumber = 0;
        message.parentHU = "";
        if (value !== undefined)
            reflectionMergePartial<HandlingunitPayload>(this, message, value);
        return message;
    }
    internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: HandlingunitPayload): HandlingunitPayload {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* api.HandlingunitInformation Information = 1 [json_name = "Information"];*/ 1:
                    message.information = HandlingunitInformation.internalBinaryRead(reader, reader.uint32(), options, message.information);
                    break;
                case /* bool ContainsGoods = 2 [json_name = "ContainsGoods"];*/ 2:
                    message.containsGoods = reader.bool();
                    break;
                case /* bool ContainsHUs = 3 [json_name = "ContainsHUs"];*/ 3:
                    message.containsHUs = reader.bool();
                    break;
                case /* repeated string IncludedHandlingunitIDs = 4 [json_name = "IncludedHandlingunitIDs"];*/ 4:
                    message.includedHandlingunitIDs.push(reader.string());
                    break;
                case /* api.TrackingSummary CurrentTrackingSummary = 5 [json_name = "CurrentTrackingSummary"];*/ 5:
                    message.currentTrackingSummary = TrackingSummary.internalBinaryRead(reader, reader.uint32(), options, message.currentTrackingSummary);
                    break;
                case /* repeated api.MetadataElement MetaData = 6 [json_name = "MetaData"];*/ 6:
                    message.metaData.push(MetadataElement.internalBinaryRead(reader, reader.uint32(), options));
                    break;
                case /* api.HandlingunitStatusStruct Status = 7 [json_name = "Status"];*/ 7:
                    message.status = HandlingunitStatusStruct.internalBinaryRead(reader, reader.uint32(), options, message.status);
                    break;
                case /* repeated api.QuantifiedGoodsByExeflow PreparedContents = 8 [json_name = "PreparedContents"];*/ 8:
                    message.preparedContents.push(QuantifiedGoodsByExeflow.internalBinaryRead(reader, reader.uint32(), options));
                    break;
                case /* repeated api.QuantifiedDatedGoodsByExeflow ReceivedContents = 9 [json_name = "ReceivedContents"];*/ 9:
                    message.receivedContents.push(QuantifiedDatedGoodsByExeflow.internalBinaryRead(reader, reader.uint32(), options));
                    break;
                case /* api.DateTime DispatchedDateTime = 10 [json_name = "DispatchedDateTime"];*/ 10:
                    message.dispatchedDateTime = DateTime.internalBinaryRead(reader, reader.uint32(), options, message.dispatchedDateTime);
                    break;
                case /* repeated string TrackingIDs = 11 [json_name = "TrackingIDs"];*/ 11:
                    message.trackingIDs.push(reader.string());
                    break;
                case /* repeated api.AttachmentSummary Attachments = 12 [json_name = "Attachments"];*/ 12:
                    message.attachments.push(AttachmentSummary.internalBinaryRead(reader, reader.uint32(), options));
                    break;
                case /* int32 AttachmentNumber = 13 [json_name = "AttachmentNumber"];*/ 13:
                    message.attachmentNumber = reader.int32();
                    break;
                case /* repeated api.ClaimSummary Claims = 14 [json_name = "Claims"];*/ 14:
                    message.claims.push(ClaimSummary.internalBinaryRead(reader, reader.uint32(), options));
                    break;
                case /* int32 ClaimNumber = 15 [json_name = "ClaimNumber"];*/ 15:
                    message.claimNumber = reader.int32();
                    break;
                case /* api.ETA HandlingunitETA = 16 [json_name = "HandlingunitETA"];*/ 16:
                    message.handlingunitETA = ETA.internalBinaryRead(reader, reader.uint32(), options, message.handlingunitETA);
                    break;
                case /* api.ETA TrackingETA = 17 [json_name = "TrackingETA"];*/ 17:
                    message.trackingETA = ETA.internalBinaryRead(reader, reader.uint32(), options, message.trackingETA);
                    break;
                case /* string ParentHU = 18 [json_name = "ParentHU"];*/ 18:
                    message.parentHU = 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: HandlingunitPayload, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
        /* api.HandlingunitInformation Information = 1 [json_name = "Information"]; */
        if (message.information)
            HandlingunitInformation.internalBinaryWrite(message.information, writer.tag(1, WireType.LengthDelimited).fork(), options).join();
        /* bool ContainsGoods = 2 [json_name = "ContainsGoods"]; */
        if (message.containsGoods !== false)
            writer.tag(2, WireType.Varint).bool(message.containsGoods);
        /* bool ContainsHUs = 3 [json_name = "ContainsHUs"]; */
        if (message.containsHUs !== false)
            writer.tag(3, WireType.Varint).bool(message.containsHUs);
        /* repeated string IncludedHandlingunitIDs = 4 [json_name = "IncludedHandlingunitIDs"]; */
        for (let i = 0; i < message.includedHandlingunitIDs.length; i++)
            writer.tag(4, WireType.LengthDelimited).string(message.includedHandlingunitIDs[i]);
        /* api.TrackingSummary CurrentTrackingSummary = 5 [json_name = "CurrentTrackingSummary"]; */
        if (message.currentTrackingSummary)
            TrackingSummary.internalBinaryWrite(message.currentTrackingSummary, writer.tag(5, WireType.LengthDelimited).fork(), options).join();
        /* repeated api.MetadataElement MetaData = 6 [json_name = "MetaData"]; */
        for (let i = 0; i < message.metaData.length; i++)
            MetadataElement.internalBinaryWrite(message.metaData[i], writer.tag(6, WireType.LengthDelimited).fork(), options).join();
        /* api.HandlingunitStatusStruct Status = 7 [json_name = "Status"]; */
        if (message.status)
            HandlingunitStatusStruct.internalBinaryWrite(message.status, writer.tag(7, WireType.LengthDelimited).fork(), options).join();
        /* repeated api.QuantifiedGoodsByExeflow PreparedContents = 8 [json_name = "PreparedContents"]; */
        for (let i = 0; i < message.preparedContents.length; i++)
            QuantifiedGoodsByExeflow.internalBinaryWrite(message.preparedContents[i], writer.tag(8, WireType.LengthDelimited).fork(), options).join();
        /* repeated api.QuantifiedDatedGoodsByExeflow ReceivedContents = 9 [json_name = "ReceivedContents"]; */
        for (let i = 0; i < message.receivedContents.length; i++)
            QuantifiedDatedGoodsByExeflow.internalBinaryWrite(message.receivedContents[i], writer.tag(9, WireType.LengthDelimited).fork(), options).join();
        /* api.DateTime DispatchedDateTime = 10 [json_name = "DispatchedDateTime"]; */
        if (message.dispatchedDateTime)
            DateTime.internalBinaryWrite(message.dispatchedDateTime, writer.tag(10, WireType.LengthDelimited).fork(), options).join();
        /* repeated string TrackingIDs = 11 [json_name = "TrackingIDs"]; */
        for (let i = 0; i < message.trackingIDs.length; i++)
            writer.tag(11, WireType.LengthDelimited).string(message.trackingIDs[i]);
        /* repeated api.AttachmentSummary Attachments = 12 [json_name = "Attachments"]; */
        for (let i = 0; i < message.attachments.length; i++)
            AttachmentSummary.internalBinaryWrite(message.attachments[i], writer.tag(12, WireType.LengthDelimited).fork(), options).join();
        /* int32 AttachmentNumber = 13 [json_name = "AttachmentNumber"]; */
        if (message.attachmentNumber !== 0)
            writer.tag(13, WireType.Varint).int32(message.attachmentNumber);
        /* repeated api.ClaimSummary Claims = 14 [json_name = "Claims"]; */
        for (let i = 0; i < message.claims.length; i++)
            ClaimSummary.internalBinaryWrite(message.claims[i], writer.tag(14, WireType.LengthDelimited).fork(), options).join();
        /* int32 ClaimNumber = 15 [json_name = "ClaimNumber"]; */
        if (message.claimNumber !== 0)
            writer.tag(15, WireType.Varint).int32(message.claimNumber);
        /* api.ETA HandlingunitETA = 16 [json_name = "HandlingunitETA"]; */
        if (message.handlingunitETA)
            ETA.internalBinaryWrite(message.handlingunitETA, writer.tag(16, WireType.LengthDelimited).fork(), options).join();
        /* api.ETA TrackingETA = 17 [json_name = "TrackingETA"]; */
        if (message.trackingETA)
            ETA.internalBinaryWrite(message.trackingETA, writer.tag(17, WireType.LengthDelimited).fork(), options).join();
        /* string ParentHU = 18 [json_name = "ParentHU"]; */
        if (message.parentHU !== "")
            writer.tag(18, WireType.LengthDelimited).string(message.parentHU);
        let u = options.writeUnknownFields;
        if (u !== false)
            (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
        return writer;
    }
}
/**
 * @generated MessageType for protobuf message api.HandlingunitPayload
 */
export const HandlingunitPayload = new HandlingunitPayload$Type();
// @generated message type with reflection information, may provide speed optimized methods
class Handlingunit$Type extends MessageType<Handlingunit> {
    constructor() {
        super("api.Handlingunit", [
            { 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: () => HandlingunitPayload }
        ]);
    }
    create(value?: PartialMessage<Handlingunit>): Handlingunit {
        const message = globalThis.Object.create((this.messagePrototype!));
        if (value !== undefined)
            reflectionMergePartial<Handlingunit>(this, message, value);
        return message;
    }
    internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: Handlingunit): Handlingunit {
        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.HandlingunitPayload Payload = 3 [json_name = "Payload"];*/ 3:
                    message.payload = HandlingunitPayload.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: Handlingunit, 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.HandlingunitPayload Payload = 3 [json_name = "Payload"]; */
        if (message.payload)
            HandlingunitPayload.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.Handlingunit
 */
export const Handlingunit = new Handlingunit$Type();
// @generated message type with reflection information, may provide speed optimized methods
class HandlingunitEnrichment$Type extends MessageType<HandlingunitEnrichment> {
    constructor() {
        super("api.HandlingunitEnrichment", [
            { 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: 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<HandlingunitEnrichment>): HandlingunitEnrichment {
        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<HandlingunitEnrichment>(this, message, value);
        return message;
    }
    internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: HandlingunitEnrichment): HandlingunitEnrichment {
        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 /* 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: HandlingunitEnrichment, 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();
        /* 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.HandlingunitEnrichment
 */
export const HandlingunitEnrichment = new HandlingunitEnrichment$Type();
// @generated message type with reflection information, may provide speed optimized methods
class HandlingunitTriplet$Type extends MessageType<HandlingunitTriplet> {
    constructor() {
        super("api.HandlingunitTriplet", [
            { no: 1, name: "Current", kind: "message", jsonName: "Current", T: () => Handlingunit },
            { no: 2, name: "Previous", kind: "message", jsonName: "Previous", T: () => Handlingunit },
            { no: 3, name: "LastEvent", kind: "message", jsonName: "LastEvent", T: () => Handlingunit }
        ]);
    }
    create(value?: PartialMessage<HandlingunitTriplet>): HandlingunitTriplet {
        const message = globalThis.Object.create((this.messagePrototype!));
        if (value !== undefined)
            reflectionMergePartial<HandlingunitTriplet>(this, message, value);
        return message;
    }
    internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: HandlingunitTriplet): HandlingunitTriplet {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* api.Handlingunit Current = 1 [json_name = "Current"];*/ 1:
                    message.current = Handlingunit.internalBinaryRead(reader, reader.uint32(), options, message.current);
                    break;
                case /* api.Handlingunit Previous = 2 [json_name = "Previous"];*/ 2:
                    message.previous = Handlingunit.internalBinaryRead(reader, reader.uint32(), options, message.previous);
                    break;
                case /* api.Handlingunit LastEvent = 3 [json_name = "LastEvent"];*/ 3:
                    message.lastEvent = Handlingunit.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: HandlingunitTriplet, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
        /* api.Handlingunit Current = 1 [json_name = "Current"]; */
        if (message.current)
            Handlingunit.internalBinaryWrite(message.current, writer.tag(1, WireType.LengthDelimited).fork(), options).join();
        /* api.Handlingunit Previous = 2 [json_name = "Previous"]; */
        if (message.previous)
            Handlingunit.internalBinaryWrite(message.previous, writer.tag(2, WireType.LengthDelimited).fork(), options).join();
        /* api.Handlingunit LastEvent = 3 [json_name = "LastEvent"]; */
        if (message.lastEvent)
            Handlingunit.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.HandlingunitTriplet
 */
export const HandlingunitTriplet = new HandlingunitTriplet$Type();
