// @generated by protobuf-ts 2.9.6
// @generated from protobuf file "actorAction.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 { ActorSnapshot } from "./repositoryShared";
// Action Summary
//   - CompleteSnapshot :               After each Snapshot completed, reset the quantity of the missing Stocks                   > stock.Snapshotted
// 

/**
 *
 * CompleteSnapshot : finalize a actor snapshot
 * by sending cumulated snapshotted quantity on stock id not already cumulated,
 * by reseting the quantity of missing stock entry for the current snapshot
 *
 * @generated from protobuf message api.ActorCompleteSnapshotPayload
 */
export interface ActorCompleteSnapshotPayload {
    /**
     * @generated from protobuf field: api.ActorSnapshot Snapshot = 1 [json_name = "Snapshot"];
     */
    snapshot?: ActorSnapshot;
}
/**
 * @generated from protobuf message api.ActorCompleteSnapshot
 */
export interface ActorCompleteSnapshot {
    /**
     * @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.ActorCompleteSnapshotPayload Payload = 3 [json_name = "Payload"];
     */
    payload?: ActorCompleteSnapshotPayload;
    /**
     * @generated from protobuf field: api.ActorCompleteSnapshotPayload EventPayload = 4 [json_name = "EventPayload"];
     */
    eventPayload?: ActorCompleteSnapshotPayload;
    /**
     * @generated from protobuf field: api.ActorCompleteSnapshotPayload PreviousPayload = 5 [json_name = "PreviousPayload"];
     */
    previousPayload?: ActorCompleteSnapshotPayload;
}
// @generated message type with reflection information, may provide speed optimized methods
class ActorCompleteSnapshotPayload$Type extends MessageType<ActorCompleteSnapshotPayload> {
    constructor() {
        super("api.ActorCompleteSnapshotPayload", [
            { no: 1, name: "Snapshot", kind: "message", jsonName: "Snapshot", T: () => ActorSnapshot }
        ], { "api.messageType": "Command", "api.payload": true, "api.action": "CompleteSnapshot" });
    }
    create(value?: PartialMessage<ActorCompleteSnapshotPayload>): ActorCompleteSnapshotPayload {
        const message = globalThis.Object.create((this.messagePrototype!));
        if (value !== undefined)
            reflectionMergePartial<ActorCompleteSnapshotPayload>(this, message, value);
        return message;
    }
    internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: ActorCompleteSnapshotPayload): ActorCompleteSnapshotPayload {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* api.ActorSnapshot Snapshot = 1 [json_name = "Snapshot"];*/ 1:
                    message.snapshot = ActorSnapshot.internalBinaryRead(reader, reader.uint32(), options, message.snapshot);
                    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: ActorCompleteSnapshotPayload, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
        /* api.ActorSnapshot Snapshot = 1 [json_name = "Snapshot"]; */
        if (message.snapshot)
            ActorSnapshot.internalBinaryWrite(message.snapshot, writer.tag(1, 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.ActorCompleteSnapshotPayload
 */
export const ActorCompleteSnapshotPayload = new ActorCompleteSnapshotPayload$Type();
// @generated message type with reflection information, may provide speed optimized methods
class ActorCompleteSnapshot$Type extends MessageType<ActorCompleteSnapshot> {
    constructor() {
        super("api.ActorCompleteSnapshot", [
            { 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: () => ActorCompleteSnapshotPayload },
            { no: 4, name: "EventPayload", kind: "message", jsonName: "EventPayload", T: () => ActorCompleteSnapshotPayload },
            { no: 5, name: "PreviousPayload", kind: "message", jsonName: "PreviousPayload", T: () => ActorCompleteSnapshotPayload }
        ], { "api.messageType": "Command", "api.action": "CompleteSnapshot", "api.resultingEvent": "stock.Snapshotted", "api.additionalSource": "stock,getActorID()", "api.triggerEventFilters": "SnapshotCompleted" });
    }
    create(value?: PartialMessage<ActorCompleteSnapshot>): ActorCompleteSnapshot {
        const message = globalThis.Object.create((this.messagePrototype!));
        if (value !== undefined)
            reflectionMergePartial<ActorCompleteSnapshot>(this, message, value);
        return message;
    }
    internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: ActorCompleteSnapshot): ActorCompleteSnapshot {
        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.ActorCompleteSnapshotPayload Payload = 3 [json_name = "Payload"];*/ 3:
                    message.payload = ActorCompleteSnapshotPayload.internalBinaryRead(reader, reader.uint32(), options, message.payload);
                    break;
                case /* api.ActorCompleteSnapshotPayload EventPayload = 4 [json_name = "EventPayload"];*/ 4:
                    message.eventPayload = ActorCompleteSnapshotPayload.internalBinaryRead(reader, reader.uint32(), options, message.eventPayload);
                    break;
                case /* api.ActorCompleteSnapshotPayload PreviousPayload = 5 [json_name = "PreviousPayload"];*/ 5:
                    message.previousPayload = ActorCompleteSnapshotPayload.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: ActorCompleteSnapshot, 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.ActorCompleteSnapshotPayload Payload = 3 [json_name = "Payload"]; */
        if (message.payload)
            ActorCompleteSnapshotPayload.internalBinaryWrite(message.payload, writer.tag(3, WireType.LengthDelimited).fork(), options).join();
        /* api.ActorCompleteSnapshotPayload EventPayload = 4 [json_name = "EventPayload"]; */
        if (message.eventPayload)
            ActorCompleteSnapshotPayload.internalBinaryWrite(message.eventPayload, writer.tag(4, WireType.LengthDelimited).fork(), options).join();
        /* api.ActorCompleteSnapshotPayload PreviousPayload = 5 [json_name = "PreviousPayload"]; */
        if (message.previousPayload)
            ActorCompleteSnapshotPayload.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.ActorCompleteSnapshot
 */
export const ActorCompleteSnapshot = new ActorCompleteSnapshot$Type();
