// @generated by protobuf-ts 2.9.6
// @generated from protobuf file "order.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 { PartnerPayload } from "./partner";
import { ActorPayload } from "./actor";
import { ItemPayload } from "./item";
import { EntityID } from "./shared";
import { EventHeader } from "./shared";
import { ETAbyExecutionflow } from "./tradeShared";
import { ClaimSummary } from "./shared";
import { AttachmentSummary } from "./shared";
import { OrderStatusStruct } from "./tradeShared";
import { ExecutionflowSummary } from "./tradeShared";
import { ETA } from "./tradeShared";
import { OrderLine } from "./tradeShared";
import { OrderRequestedMilestones } from "./tradeShared";
import { TradeTier } from "./tradeShared";
import { MetadataElement } from "./shared";
import { ReferencedID } from "./tradeShared";
import { DateTime } from "./shared";
// 
// This entity wears the content of Trade order.
// 
// Most of the structure represent the request, they may be modified by some events (ShipperAssigned, ...).
// 
// Another set of data represents how the request was executed. These informations are coming from the ExecutionFlowEntity.
// 
// Comments updated 2021/02/17

/**
 * @generated from protobuf message api.OrderPayload
 */
export interface OrderPayload {
    /**
     * @generated from protobuf field: api.DateTime CreationDateTime = 1 [json_name = "CreationDateTime"];
     */
    creationDateTime?: DateTime;
    /**
     * @generated from protobuf field: api.ReferencedID ParentOrder = 2 [json_name = "ParentOrder"];
     */
    parentOrder?: ReferencedID; // In case the order is linked to a parent order
    /**
     * @generated from protobuf field: string LanguageCodeISO6391 = 3 [json_name = "LanguageCodeISO6391"];
     */
    languageCodeISO6391: string;
    /**
     * 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 = 4 [json_name = "MetaData"];
     */
    metaData: MetadataElement[];
    /**
     * @generated from protobuf field: api.TradeTier Buyer = 5 [json_name = "Buyer"];
     */
    buyer?: TradeTier;
    /**
     * @generated from protobuf field: api.TradeTier Seller = 6 [json_name = "Seller"];
     */
    seller?: TradeTier;
    /**
     * Where to ship the order from
     *
     * @generated from protobuf field: api.TradeTier ShipFrom = 7 [json_name = "ShipFrom"];
     */
    shipFrom?: TradeTier;
    /**
     * Where to ship the order to
     *
     * @generated from protobuf field: api.TradeTier ShipTo = 8 [json_name = "ShipTo"];
     */
    shipTo?: TradeTier;
    /**
     * Definition of the order carrier
     *
     * @generated from protobuf field: api.TradeTier Carrier = 9 [json_name = "Carrier"];
     */
    carrier?: TradeTier;
    /**
     * Type of carrier service
     *
     * @generated from protobuf field: string CarrierService = 16 [json_name = "CarrierService"];
     */
    carrierService: string;
    /**
     * @generated from protobuf field: api.OrderRequestedMilestones RequestedMilestones = 10 [json_name = "RequestedMilestones"];
     */
    requestedMilestones?: OrderRequestedMilestones;
    /**
     * Lines of the order
     *
     * @generated from protobuf field: repeated api.OrderLine Lines = 11 [json_name = "Lines"];
     */
    lines: OrderLine[];
    /**
     * @deprecated
     * @generated from protobuf field: api.ETA EstimatedTimeArrival = 12 [deprecated = true, json_name = "EstimatedTimeArrival"];
     */
    estimatedTimeArrival?: ETA;
    /**
     * @generated from protobuf field: api.DateTime ActualCompletionDateTime = 13 [json_name = "ActualCompletionDateTime"];
     */
    actualCompletionDateTime?: DateTime;
    /**
     * @generated from protobuf field: repeated api.ExecutionflowSummary ExecutionflowSummary = 14 [json_name = "ExecutionflowSummary"];
     */
    executionflowSummary: ExecutionflowSummary[]; // Summary describing how the order is executed by ExecutionFlow
    /**
     * @generated from protobuf field: api.OrderStatusStruct Status = 17 [json_name = "Status"];
     */
    status?: OrderStatusStruct; // Status field is not accessible from APIs
    /**
     * @generated from protobuf field: repeated api.AttachmentSummary Attachments = 18 [json_name = "Attachments"];
     */
    attachments: AttachmentSummary[];
    /**
     * @generated from protobuf field: int32 AttachmentNumber = 19 [json_name = "AttachmentNumber"];
     */
    attachmentNumber: number;
    /**
     * @generated from protobuf field: repeated api.ClaimSummary Claims = 20 [json_name = "Claims"];
     */
    claims: ClaimSummary[];
    /**
     * @generated from protobuf field: int32 ClaimNumber = 21 [json_name = "ClaimNumber"];
     */
    claimNumber: number;
    /**
     * @generated from protobuf field: repeated api.ETAbyExecutionflow ExecutionflowETAs = 22 [json_name = "ExecutionflowETAs"];
     */
    executionflowETAs: ETAbyExecutionflow[]; // Estimated Time of Arrival for the ExecutionFlow(s) created for this order
    /**
     * @generated from protobuf field: api.ETA OrderETA = 23 [json_name = "OrderETA"];
     */
    orderETA?: ETA;
}
/**
 * Order entity
 *
 * @generated from protobuf message api.Order
 */
export interface Order {
    /**
     * @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.OrderPayload Payload = 3 [json_name = "Payload"];
     */
    payload?: OrderPayload;
}
/**
 * Order Enrichment
 *
 * @generated from protobuf message api.OrderEnrichment
 */
export interface OrderEnrichment {
    /**
     * @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: "partner";
        /**
         * @generated from protobuf field: api.PartnerPayload Partner = 12 [json_name = "Partner"];
         */
        partner: PartnerPayload;
    } | {
        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.OrderTriplet
 */
export interface OrderTriplet {
    /**
     * @generated from protobuf field: api.Order Current = 1 [json_name = "Current"];
     */
    current?: Order;
    /**
     * @generated from protobuf field: api.Order Previous = 2 [json_name = "Previous"];
     */
    previous?: Order;
    /**
     * @generated from protobuf field: api.Order LastEvent = 3 [json_name = "LastEvent"];
     */
    lastEvent?: Order;
}
// @generated message type with reflection information, may provide speed optimized methods
class OrderPayload$Type extends MessageType<OrderPayload> {
    constructor() {
        super("api.OrderPayload", [
            { no: 1, name: "CreationDateTime", kind: "message", jsonName: "CreationDateTime", T: () => DateTime, options: { "api.aggSkip": "ExecutionflowDetected" } },
            { no: 2, name: "ParentOrder", kind: "message", jsonName: "ParentOrder", T: () => ReferencedID },
            { no: 3, name: "LanguageCodeISO6391", kind: "scalar", jsonName: "LanguageCodeISO6391", T: 9 /*ScalarType.STRING*/, options: { "validate.rules": { string: { minLen: "2", maxLen: "3", languageIso639: true } }, "grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field": { description: "<a href='https://en.wikipedia.org/wiki/List_of_ISO_639_language_codes'>ISO 639 code</a> message language", example: "\"en\"" }, "api.indexationType": { Types: [{ Context: "*", Type: "generatedText" }] }, "api.viewType": { Types: [{ Context: "*", Type: "shortText" }] } } },
            { no: 4, 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.kpiExclude": { Items: [{ Context: "Order", Group: "order" }] }, "api.aggAppend": "MetaDataUpdated,ExecutionflowDetected" } },
            { no: 5, name: "Buyer", kind: "message", jsonName: "Buyer", T: () => TradeTier },
            { no: 6, name: "Seller", kind: "message", jsonName: "Seller", T: () => TradeTier },
            { no: 7, name: "ShipFrom", kind: "message", jsonName: "ShipFrom", T: () => TradeTier, options: { "grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field": { description: "Where to ship the order from" }, "api.aggSkip": "ExecutionflowDetected" } },
            { no: 8, name: "ShipTo", kind: "message", jsonName: "ShipTo", T: () => TradeTier, options: { "grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field": { description: "Where to ship the order to" }, "api.aggSkip": "ExecutionflowDetected" } },
            { no: 9, name: "Carrier", kind: "message", jsonName: "Carrier", T: () => TradeTier, options: { "grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field": { description: "Definition of the order carrier" }, "api.aggSkip": "ExecutionflowDetected" } },
            { no: 16, name: "CarrierService", kind: "scalar", jsonName: "CarrierService", T: 9 /*ScalarType.STRING*/, options: { "grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field": { description: "Type of carrier service" }, "api.dataRestrictionKey": "Order", "api.kpiItems": { Items: [{ Context: "Order", Group: "order", Queryable: true }] } } },
            { no: 10, name: "RequestedMilestones", kind: "message", jsonName: "RequestedMilestones", T: () => OrderRequestedMilestones },
            { no: 11, name: "Lines", kind: "message", jsonName: "Lines", repeat: 1 /*RepeatType.PACKED*/, T: () => OrderLine, options: { "grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field": { description: "Lines of the order" }, "api.aggKey": "LineID", "api.aggAppend": "ExecutionflowDetected" } },
            { no: 12, name: "EstimatedTimeArrival", kind: "message", jsonName: "EstimatedTimeArrival", T: () => ETA, options: { "grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field": { description: "Deprecated from 1.7 : Estimated time of arrival, use OrderETA" } } },
            { no: 13, name: "ActualCompletionDateTime", kind: "message", jsonName: "ActualCompletionDateTime", T: () => DateTime },
            { no: 14, name: "ExecutionflowSummary", kind: "message", jsonName: "ExecutionflowSummary", repeat: 1 /*RepeatType.PACKED*/, T: () => ExecutionflowSummary, options: { "api.aggKey": "ExecutionflowID", "api.aggAppend": "ExecutionflowUpdated,ExecutionflowDetected" } },
            { no: 17, name: "Status", kind: "message", jsonName: "Status", T: () => OrderStatusStruct, options: { "validate.rules": { message: { unauthorized: true } }, "grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field": { readOnly: true } } },
            { no: 18, 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: 19, 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: 20, 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: 21, 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: 22, name: "ExecutionflowETAs", kind: "message", jsonName: "ExecutionflowETAs", repeat: 1 /*RepeatType.PACKED*/, T: () => ETAbyExecutionflow, options: { "grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field": { description: "ETA for each executionflow attached to the order" }, "api.aggKey": "ExecutionflowID", "api.aggSkip": "ExecutionflowETAUpdated" } },
            { no: 23, name: "OrderETA", kind: "message", jsonName: "OrderETA", T: () => ETA, options: { "validate.rules": { message: { unauthorized: true } }, "grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field": { description: "ETA for the order, computed from ETA of the execitionFlows" }, "api.aggSkip": "ETAUpdated" } }
        ]);
    }
    create(value?: PartialMessage<OrderPayload>): OrderPayload {
        const message = globalThis.Object.create((this.messagePrototype!));
        message.languageCodeISO6391 = "";
        message.metaData = [];
        message.carrierService = "";
        message.lines = [];
        message.executionflowSummary = [];
        message.attachments = [];
        message.attachmentNumber = 0;
        message.claims = [];
        message.claimNumber = 0;
        message.executionflowETAs = [];
        if (value !== undefined)
            reflectionMergePartial<OrderPayload>(this, message, value);
        return message;
    }
    internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: OrderPayload): OrderPayload {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* api.DateTime CreationDateTime = 1 [json_name = "CreationDateTime"];*/ 1:
                    message.creationDateTime = DateTime.internalBinaryRead(reader, reader.uint32(), options, message.creationDateTime);
                    break;
                case /* api.ReferencedID ParentOrder = 2 [json_name = "ParentOrder"];*/ 2:
                    message.parentOrder = ReferencedID.internalBinaryRead(reader, reader.uint32(), options, message.parentOrder);
                    break;
                case /* string LanguageCodeISO6391 = 3 [json_name = "LanguageCodeISO6391"];*/ 3:
                    message.languageCodeISO6391 = reader.string();
                    break;
                case /* repeated api.MetadataElement MetaData = 4 [json_name = "MetaData"];*/ 4:
                    message.metaData.push(MetadataElement.internalBinaryRead(reader, reader.uint32(), options));
                    break;
                case /* api.TradeTier Buyer = 5 [json_name = "Buyer"];*/ 5:
                    message.buyer = TradeTier.internalBinaryRead(reader, reader.uint32(), options, message.buyer);
                    break;
                case /* api.TradeTier Seller = 6 [json_name = "Seller"];*/ 6:
                    message.seller = TradeTier.internalBinaryRead(reader, reader.uint32(), options, message.seller);
                    break;
                case /* api.TradeTier ShipFrom = 7 [json_name = "ShipFrom"];*/ 7:
                    message.shipFrom = TradeTier.internalBinaryRead(reader, reader.uint32(), options, message.shipFrom);
                    break;
                case /* api.TradeTier ShipTo = 8 [json_name = "ShipTo"];*/ 8:
                    message.shipTo = TradeTier.internalBinaryRead(reader, reader.uint32(), options, message.shipTo);
                    break;
                case /* api.TradeTier Carrier = 9 [json_name = "Carrier"];*/ 9:
                    message.carrier = TradeTier.internalBinaryRead(reader, reader.uint32(), options, message.carrier);
                    break;
                case /* string CarrierService = 16 [json_name = "CarrierService"];*/ 16:
                    message.carrierService = reader.string();
                    break;
                case /* api.OrderRequestedMilestones RequestedMilestones = 10 [json_name = "RequestedMilestones"];*/ 10:
                    message.requestedMilestones = OrderRequestedMilestones.internalBinaryRead(reader, reader.uint32(), options, message.requestedMilestones);
                    break;
                case /* repeated api.OrderLine Lines = 11 [json_name = "Lines"];*/ 11:
                    message.lines.push(OrderLine.internalBinaryRead(reader, reader.uint32(), options));
                    break;
                case /* api.ETA EstimatedTimeArrival = 12 [deprecated = true, json_name = "EstimatedTimeArrival"];*/ 12:
                    message.estimatedTimeArrival = ETA.internalBinaryRead(reader, reader.uint32(), options, message.estimatedTimeArrival);
                    break;
                case /* api.DateTime ActualCompletionDateTime = 13 [json_name = "ActualCompletionDateTime"];*/ 13:
                    message.actualCompletionDateTime = DateTime.internalBinaryRead(reader, reader.uint32(), options, message.actualCompletionDateTime);
                    break;
                case /* repeated api.ExecutionflowSummary ExecutionflowSummary = 14 [json_name = "ExecutionflowSummary"];*/ 14:
                    message.executionflowSummary.push(ExecutionflowSummary.internalBinaryRead(reader, reader.uint32(), options));
                    break;
                case /* api.OrderStatusStruct Status = 17 [json_name = "Status"];*/ 17:
                    message.status = OrderStatusStruct.internalBinaryRead(reader, reader.uint32(), options, message.status);
                    break;
                case /* repeated api.AttachmentSummary Attachments = 18 [json_name = "Attachments"];*/ 18:
                    message.attachments.push(AttachmentSummary.internalBinaryRead(reader, reader.uint32(), options));
                    break;
                case /* int32 AttachmentNumber = 19 [json_name = "AttachmentNumber"];*/ 19:
                    message.attachmentNumber = reader.int32();
                    break;
                case /* repeated api.ClaimSummary Claims = 20 [json_name = "Claims"];*/ 20:
                    message.claims.push(ClaimSummary.internalBinaryRead(reader, reader.uint32(), options));
                    break;
                case /* int32 ClaimNumber = 21 [json_name = "ClaimNumber"];*/ 21:
                    message.claimNumber = reader.int32();
                    break;
                case /* repeated api.ETAbyExecutionflow ExecutionflowETAs = 22 [json_name = "ExecutionflowETAs"];*/ 22:
                    message.executionflowETAs.push(ETAbyExecutionflow.internalBinaryRead(reader, reader.uint32(), options));
                    break;
                case /* api.ETA OrderETA = 23 [json_name = "OrderETA"];*/ 23:
                    message.orderETA = ETA.internalBinaryRead(reader, reader.uint32(), options, message.orderETA);
                    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: OrderPayload, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
        /* api.DateTime CreationDateTime = 1 [json_name = "CreationDateTime"]; */
        if (message.creationDateTime)
            DateTime.internalBinaryWrite(message.creationDateTime, writer.tag(1, WireType.LengthDelimited).fork(), options).join();
        /* api.ReferencedID ParentOrder = 2 [json_name = "ParentOrder"]; */
        if (message.parentOrder)
            ReferencedID.internalBinaryWrite(message.parentOrder, writer.tag(2, WireType.LengthDelimited).fork(), options).join();
        /* string LanguageCodeISO6391 = 3 [json_name = "LanguageCodeISO6391"]; */
        if (message.languageCodeISO6391 !== "")
            writer.tag(3, WireType.LengthDelimited).string(message.languageCodeISO6391);
        /* repeated api.MetadataElement MetaData = 4 [json_name = "MetaData"]; */
        for (let i = 0; i < message.metaData.length; i++)
            MetadataElement.internalBinaryWrite(message.metaData[i], writer.tag(4, WireType.LengthDelimited).fork(), options).join();
        /* api.TradeTier Buyer = 5 [json_name = "Buyer"]; */
        if (message.buyer)
            TradeTier.internalBinaryWrite(message.buyer, writer.tag(5, WireType.LengthDelimited).fork(), options).join();
        /* api.TradeTier Seller = 6 [json_name = "Seller"]; */
        if (message.seller)
            TradeTier.internalBinaryWrite(message.seller, writer.tag(6, WireType.LengthDelimited).fork(), options).join();
        /* api.TradeTier ShipFrom = 7 [json_name = "ShipFrom"]; */
        if (message.shipFrom)
            TradeTier.internalBinaryWrite(message.shipFrom, writer.tag(7, WireType.LengthDelimited).fork(), options).join();
        /* api.TradeTier ShipTo = 8 [json_name = "ShipTo"]; */
        if (message.shipTo)
            TradeTier.internalBinaryWrite(message.shipTo, writer.tag(8, WireType.LengthDelimited).fork(), options).join();
        /* api.TradeTier Carrier = 9 [json_name = "Carrier"]; */
        if (message.carrier)
            TradeTier.internalBinaryWrite(message.carrier, writer.tag(9, WireType.LengthDelimited).fork(), options).join();
        /* string CarrierService = 16 [json_name = "CarrierService"]; */
        if (message.carrierService !== "")
            writer.tag(16, WireType.LengthDelimited).string(message.carrierService);
        /* api.OrderRequestedMilestones RequestedMilestones = 10 [json_name = "RequestedMilestones"]; */
        if (message.requestedMilestones)
            OrderRequestedMilestones.internalBinaryWrite(message.requestedMilestones, writer.tag(10, WireType.LengthDelimited).fork(), options).join();
        /* repeated api.OrderLine Lines = 11 [json_name = "Lines"]; */
        for (let i = 0; i < message.lines.length; i++)
            OrderLine.internalBinaryWrite(message.lines[i], writer.tag(11, WireType.LengthDelimited).fork(), options).join();
        /* api.ETA EstimatedTimeArrival = 12 [deprecated = true, json_name = "EstimatedTimeArrival"]; */
        if (message.estimatedTimeArrival)
            ETA.internalBinaryWrite(message.estimatedTimeArrival, writer.tag(12, WireType.LengthDelimited).fork(), options).join();
        /* api.DateTime ActualCompletionDateTime = 13 [json_name = "ActualCompletionDateTime"]; */
        if (message.actualCompletionDateTime)
            DateTime.internalBinaryWrite(message.actualCompletionDateTime, writer.tag(13, WireType.LengthDelimited).fork(), options).join();
        /* repeated api.ExecutionflowSummary ExecutionflowSummary = 14 [json_name = "ExecutionflowSummary"]; */
        for (let i = 0; i < message.executionflowSummary.length; i++)
            ExecutionflowSummary.internalBinaryWrite(message.executionflowSummary[i], writer.tag(14, WireType.LengthDelimited).fork(), options).join();
        /* api.OrderStatusStruct Status = 17 [json_name = "Status"]; */
        if (message.status)
            OrderStatusStruct.internalBinaryWrite(message.status, writer.tag(17, WireType.LengthDelimited).fork(), options).join();
        /* repeated api.AttachmentSummary Attachments = 18 [json_name = "Attachments"]; */
        for (let i = 0; i < message.attachments.length; i++)
            AttachmentSummary.internalBinaryWrite(message.attachments[i], writer.tag(18, WireType.LengthDelimited).fork(), options).join();
        /* int32 AttachmentNumber = 19 [json_name = "AttachmentNumber"]; */
        if (message.attachmentNumber !== 0)
            writer.tag(19, WireType.Varint).int32(message.attachmentNumber);
        /* repeated api.ClaimSummary Claims = 20 [json_name = "Claims"]; */
        for (let i = 0; i < message.claims.length; i++)
            ClaimSummary.internalBinaryWrite(message.claims[i], writer.tag(20, WireType.LengthDelimited).fork(), options).join();
        /* int32 ClaimNumber = 21 [json_name = "ClaimNumber"]; */
        if (message.claimNumber !== 0)
            writer.tag(21, WireType.Varint).int32(message.claimNumber);
        /* repeated api.ETAbyExecutionflow ExecutionflowETAs = 22 [json_name = "ExecutionflowETAs"]; */
        for (let i = 0; i < message.executionflowETAs.length; i++)
            ETAbyExecutionflow.internalBinaryWrite(message.executionflowETAs[i], writer.tag(22, WireType.LengthDelimited).fork(), options).join();
        /* api.ETA OrderETA = 23 [json_name = "OrderETA"]; */
        if (message.orderETA)
            ETA.internalBinaryWrite(message.orderETA, writer.tag(23, 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.OrderPayload
 */
export const OrderPayload = new OrderPayload$Type();
// @generated message type with reflection information, may provide speed optimized methods
class Order$Type extends MessageType<Order> {
    constructor() {
        super("api.Order", [
            { 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: () => OrderPayload }
        ]);
    }
    create(value?: PartialMessage<Order>): Order {
        const message = globalThis.Object.create((this.messagePrototype!));
        if (value !== undefined)
            reflectionMergePartial<Order>(this, message, value);
        return message;
    }
    internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: Order): Order {
        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.OrderPayload Payload = 3 [json_name = "Payload"];*/ 3:
                    message.payload = OrderPayload.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: Order, 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.OrderPayload Payload = 3 [json_name = "Payload"]; */
        if (message.payload)
            OrderPayload.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.Order
 */
export const Order = new Order$Type();
// @generated message type with reflection information, may provide speed optimized methods
class OrderEnrichment$Type extends MessageType<OrderEnrichment> {
    constructor() {
        super("api.OrderEnrichment", [
            { 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: 12, name: "Partner", kind: "message", jsonName: "Partner", oneof: "content", T: () => PartnerPayload },
            { 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<OrderEnrichment>): OrderEnrichment {
        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<OrderEnrichment>(this, message, value);
        return message;
    }
    internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: OrderEnrichment): OrderEnrichment {
        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 /* api.PartnerPayload Partner = 12 [json_name = "Partner"];*/ 12:
                    message.content = {
                        oneofKind: "partner",
                        partner: PartnerPayload.internalBinaryRead(reader, reader.uint32(), options, (message.content as any).partner)
                    };
                    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: OrderEnrichment, 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();
        /* api.PartnerPayload Partner = 12 [json_name = "Partner"]; */
        if (message.content.oneofKind === "partner")
            PartnerPayload.internalBinaryWrite(message.content.partner, writer.tag(12, 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.OrderEnrichment
 */
export const OrderEnrichment = new OrderEnrichment$Type();
// @generated message type with reflection information, may provide speed optimized methods
class OrderTriplet$Type extends MessageType<OrderTriplet> {
    constructor() {
        super("api.OrderTriplet", [
            { no: 1, name: "Current", kind: "message", jsonName: "Current", T: () => Order },
            { no: 2, name: "Previous", kind: "message", jsonName: "Previous", T: () => Order },
            { no: 3, name: "LastEvent", kind: "message", jsonName: "LastEvent", T: () => Order }
        ]);
    }
    create(value?: PartialMessage<OrderTriplet>): OrderTriplet {
        const message = globalThis.Object.create((this.messagePrototype!));
        if (value !== undefined)
            reflectionMergePartial<OrderTriplet>(this, message, value);
        return message;
    }
    internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: OrderTriplet): OrderTriplet {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* api.Order Current = 1 [json_name = "Current"];*/ 1:
                    message.current = Order.internalBinaryRead(reader, reader.uint32(), options, message.current);
                    break;
                case /* api.Order Previous = 2 [json_name = "Previous"];*/ 2:
                    message.previous = Order.internalBinaryRead(reader, reader.uint32(), options, message.previous);
                    break;
                case /* api.Order LastEvent = 3 [json_name = "LastEvent"];*/ 3:
                    message.lastEvent = Order.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: OrderTriplet, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
        /* api.Order Current = 1 [json_name = "Current"]; */
        if (message.current)
            Order.internalBinaryWrite(message.current, writer.tag(1, WireType.LengthDelimited).fork(), options).join();
        /* api.Order Previous = 2 [json_name = "Previous"]; */
        if (message.previous)
            Order.internalBinaryWrite(message.previous, writer.tag(2, WireType.LengthDelimited).fork(), options).join();
        /* api.Order LastEvent = 3 [json_name = "LastEvent"]; */
        if (message.lastEvent)
            Order.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.OrderTriplet
 */
export const OrderTriplet = new OrderTriplet$Type();
