// @generated by protobuf-ts 2.9.6
// @generated from protobuf file "movementAction.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 { EntityID } from "./shared";
import { CommandHeader } from "./shared";
import { StockMovement } from "./warehousingShared";
import { EnrichedGoods } from "./warehousingShared";
// _common_

// Action Summary

/**
 *
 * GenerateDelta : replicate tracking status on all included logistic units
 *
 * @generated from protobuf message api.MovementSendToStockPayload
 */
export interface MovementSendToStockPayload {
    /**
     * @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.StockMovement Movement = 3 [json_name = "Movement"];
     */
    movement?: StockMovement;
}
/**
 * @generated from protobuf message api.MovementSendToStock
 */
export interface MovementSendToStock {
    /**
     * @generated from protobuf field: api.CommandHeader Header = 1 [json_name = "Header"];
     */
    header?: CommandHeader;
    /**
     * @generated from protobuf field: api.EntityID ID = 2 [json_name = "ID"];
     */
    iD?: EntityID;
    /**
     * @generated from protobuf field: api.MovementSendToStockPayload Payload = 3 [json_name = "Payload"];
     */
    payload?: MovementSendToStockPayload;
    /**
     * @generated from protobuf field: api.MovementSendToStockPayload EventPayload = 4 [json_name = "EventPayload"];
     */
    eventPayload?: MovementSendToStockPayload;
    /**
     * @generated from protobuf field: api.MovementSendToStockPayload PreviousPayload = 5 [json_name = "PreviousPayload"];
     */
    previousPayload?: MovementSendToStockPayload;
}
// @generated message type with reflection information, may provide speed optimized methods
class MovementSendToStockPayload$Type extends MessageType<MovementSendToStockPayload> {
    constructor() {
        super("api.MovementSendToStockPayload", [
            { no: 1, name: "Goods", kind: "message", jsonName: "Goods", T: () => EnrichedGoods },
            { no: 2, name: "ActorID", kind: "scalar", jsonName: "ActorID", T: 9 /*ScalarType.STRING*/ },
            { no: 3, name: "Movement", kind: "message", jsonName: "Movement", T: () => StockMovement }
        ], { "api.messageType": "Command", "api.payload": true, "api.action": "SendToStock" });
    }
    create(value?: PartialMessage<MovementSendToStockPayload>): MovementSendToStockPayload {
        const message = globalThis.Object.create((this.messagePrototype!));
        message.actorID = "";
        if (value !== undefined)
            reflectionMergePartial<MovementSendToStockPayload>(this, message, value);
        return message;
    }
    internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: MovementSendToStockPayload): MovementSendToStockPayload {
        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.StockMovement Movement = 3 [json_name = "Movement"];*/ 3:
                    message.movement = StockMovement.internalBinaryRead(reader, reader.uint32(), options, message.movement);
                    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: MovementSendToStockPayload, 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.StockMovement Movement = 3 [json_name = "Movement"]; */
        if (message.movement)
            StockMovement.internalBinaryWrite(message.movement, 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.MovementSendToStockPayload
 */
export const MovementSendToStockPayload = new MovementSendToStockPayload$Type();
// @generated message type with reflection information, may provide speed optimized methods
class MovementSendToStock$Type extends MessageType<MovementSendToStock> {
    constructor() {
        super("api.MovementSendToStock", [
            { no: 1, name: "Header", kind: "message", jsonName: "Header", T: () => CommandHeader },
            { no: 2, name: "ID", kind: "message", jsonName: "ID", T: () => EntityID },
            { no: 3, name: "Payload", kind: "message", jsonName: "Payload", T: () => MovementSendToStockPayload },
            { no: 4, name: "EventPayload", kind: "message", jsonName: "EventPayload", T: () => MovementSendToStockPayload },
            { no: 5, name: "PreviousPayload", kind: "message", jsonName: "PreviousPayload", T: () => MovementSendToStockPayload }
        ], { "api.messageType": "Command", "api.action": "SendToStock", "api.resultingEvent": "stock.Moved", "api.triggerEventFilters": "Created,Generated" });
    }
    create(value?: PartialMessage<MovementSendToStock>): MovementSendToStock {
        const message = globalThis.Object.create((this.messagePrototype!));
        if (value !== undefined)
            reflectionMergePartial<MovementSendToStock>(this, message, value);
        return message;
    }
    internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: MovementSendToStock): MovementSendToStock {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* api.CommandHeader Header = 1 [json_name = "Header"];*/ 1:
                    message.header = CommandHeader.internalBinaryRead(reader, reader.uint32(), options, message.header);
                    break;
                case /* api.EntityID ID = 2 [json_name = "ID"];*/ 2:
                    message.iD = EntityID.internalBinaryRead(reader, reader.uint32(), options, message.iD);
                    break;
                case /* api.MovementSendToStockPayload Payload = 3 [json_name = "Payload"];*/ 3:
                    message.payload = MovementSendToStockPayload.internalBinaryRead(reader, reader.uint32(), options, message.payload);
                    break;
                case /* api.MovementSendToStockPayload EventPayload = 4 [json_name = "EventPayload"];*/ 4:
                    message.eventPayload = MovementSendToStockPayload.internalBinaryRead(reader, reader.uint32(), options, message.eventPayload);
                    break;
                case /* api.MovementSendToStockPayload PreviousPayload = 5 [json_name = "PreviousPayload"];*/ 5:
                    message.previousPayload = MovementSendToStockPayload.internalBinaryRead(reader, reader.uint32(), options, message.previousPayload);
                    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: MovementSendToStock, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
        /* api.CommandHeader Header = 1 [json_name = "Header"]; */
        if (message.header)
            CommandHeader.internalBinaryWrite(message.header, 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.MovementSendToStockPayload Payload = 3 [json_name = "Payload"]; */
        if (message.payload)
            MovementSendToStockPayload.internalBinaryWrite(message.payload, writer.tag(3, WireType.LengthDelimited).fork(), options).join();
        /* api.MovementSendToStockPayload EventPayload = 4 [json_name = "EventPayload"]; */
        if (message.eventPayload)
            MovementSendToStockPayload.internalBinaryWrite(message.eventPayload, writer.tag(4, WireType.LengthDelimited).fork(), options).join();
        /* api.MovementSendToStockPayload PreviousPayload = 5 [json_name = "PreviousPayload"]; */
        if (message.previousPayload)
            MovementSendToStockPayload.internalBinaryWrite(message.previousPayload, writer.tag(5, 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.MovementSendToStock
 */
export const MovementSendToStock = new MovementSendToStock$Type();
