// @generated by protobuf-ts 2.11.1 with parameter long_type_string,ts_nocheck
// @generated from protobuf file "runtime/v1/app.proto" (package "nimi.runtime.v1", syntax proto3)
// tslint:disable
// @ts-nocheck
import { ServiceType } from "@protobuf-ts/runtime-rpc";
import { WireType } from "@protobuf-ts/runtime";
import { UnknownFieldHandler } from "@protobuf-ts/runtime";
import { reflectionMergePartial } from "@protobuf-ts/runtime";
import { MessageType } from "@protobuf-ts/runtime";
import { Timestamp } from "../../google/protobuf/timestamp.js";
import { ReasonCode } from "./common.js";
import { ScopedRuntimeBindingAttachment } from "./common.js";
import { Struct } from "../../google/protobuf/struct.js";
/**
 * @generated from protobuf enum nimi.runtime.v1.AppMessageEventType
 */
export var AppMessageEventType;
(function (AppMessageEventType) {
    /**
     * @generated from protobuf enum value: APP_MESSAGE_EVENT_TYPE_UNSPECIFIED = 0;
     */
    AppMessageEventType[AppMessageEventType["APP_MESSAGE_EVENT_TYPE_UNSPECIFIED"] = 0] = "APP_MESSAGE_EVENT_TYPE_UNSPECIFIED";
    /**
     * @generated from protobuf enum value: APP_MESSAGE_EVENT_RECEIVED = 1;
     */
    AppMessageEventType[AppMessageEventType["APP_MESSAGE_EVENT_RECEIVED"] = 1] = "APP_MESSAGE_EVENT_RECEIVED";
    /**
     * @generated from protobuf enum value: APP_MESSAGE_EVENT_ACKED = 2;
     */
    AppMessageEventType[AppMessageEventType["APP_MESSAGE_EVENT_ACKED"] = 2] = "APP_MESSAGE_EVENT_ACKED";
    /**
     * @generated from protobuf enum value: APP_MESSAGE_EVENT_FAILED = 3;
     */
    AppMessageEventType[AppMessageEventType["APP_MESSAGE_EVENT_FAILED"] = 3] = "APP_MESSAGE_EVENT_FAILED";
})(AppMessageEventType || (AppMessageEventType = {}));
// === Nimi App Install/Uninstall Lifecycle (K-APP-011..K-APP-014) ===
/**
 * AppInstallJobPhase is the typed install/update pipeline phase. It surfaces
 * the concrete step so the product Apps card can show "download / verify /
 * materialize / unpack / swap / evidence" instead of a generic spinner. It is
 * never inferred from transfer/process/file state. The same phase shape covers
 * install, update, and healthRepair jobs (K-APP-015 / K-APP-016).
 *
 * @generated from protobuf enum nimi.runtime.v1.AppInstallJobPhase
 */
export var AppInstallJobPhase;
(function (AppInstallJobPhase) {
    /**
     * @generated from protobuf enum value: APP_INSTALL_JOB_PHASE_UNSPECIFIED = 0;
     */
    AppInstallJobPhase[AppInstallJobPhase["UNSPECIFIED"] = 0] = "UNSPECIFIED";
    /**
     * @generated from protobuf enum value: APP_INSTALL_JOB_PHASE_QUEUED = 1;
     */
    AppInstallJobPhase[AppInstallJobPhase["QUEUED"] = 1] = "QUEUED";
    /**
     * @generated from protobuf enum value: APP_INSTALL_JOB_PHASE_RESOLVE_DESCRIPTOR = 2;
     */
    AppInstallJobPhase[AppInstallJobPhase["RESOLVE_DESCRIPTOR"] = 2] = "RESOLVE_DESCRIPTOR";
    /**
     * @generated from protobuf enum value: APP_INSTALL_JOB_PHASE_DOWNLOAD = 3;
     */
    AppInstallJobPhase[AppInstallJobPhase["DOWNLOAD"] = 3] = "DOWNLOAD";
    /**
     * @generated from protobuf enum value: APP_INSTALL_JOB_PHASE_VERIFY = 4;
     */
    AppInstallJobPhase[AppInstallJobPhase["VERIFY"] = 4] = "VERIFY";
    /**
     * @generated from protobuf enum value: APP_INSTALL_JOB_PHASE_MATERIALIZE = 5;
     */
    AppInstallJobPhase[AppInstallJobPhase["MATERIALIZE"] = 5] = "MATERIALIZE";
    /**
     * @generated from protobuf enum value: APP_INSTALL_JOB_PHASE_UNPACK = 6;
     */
    AppInstallJobPhase[AppInstallJobPhase["UNPACK"] = 6] = "UNPACK";
    /**
     * @generated from protobuf enum value: APP_INSTALL_JOB_PHASE_EVIDENCE = 7;
     */
    AppInstallJobPhase[AppInstallJobPhase["EVIDENCE"] = 7] = "EVIDENCE";
    /**
     * @generated from protobuf enum value: APP_INSTALL_JOB_PHASE_INSTALLED = 8;
     */
    AppInstallJobPhase[AppInstallJobPhase["INSTALLED"] = 8] = "INSTALLED";
    /**
     * @generated from protobuf enum value: APP_INSTALL_JOB_PHASE_FAILED = 9;
     */
    AppInstallJobPhase[AppInstallJobPhase["FAILED"] = 9] = "FAILED";
    /**
     * APP_INSTALL_JOB_PHASE_SWAP is the atomic active-release pointer swap of an
     * update job. It runs only after the new release is fully materialized and
     * digest-verified; the old release stays usable until the swap commits.
     *
     * @generated from protobuf enum value: APP_INSTALL_JOB_PHASE_SWAP = 10;
     */
    AppInstallJobPhase[AppInstallJobPhase["SWAP"] = 10] = "SWAP";
    /**
     * APP_INSTALL_JOB_PHASE_CANCELLED is the terminal phase of a job cancelled
     * through HealthRepairApp(action=cancel).
     *
     * @generated from protobuf enum value: APP_INSTALL_JOB_PHASE_CANCELLED = 11;
     */
    AppInstallJobPhase[AppInstallJobPhase["CANCELLED"] = 11] = "CANCELLED";
    /**
     * APP_INSTALL_JOB_PHASE_UNINSTALLED is the terminal phase of a completed
     * uninstall lifecycle job (K-APP-017). It is reached only by a job of kind
     * APP_LIFECYCLE_JOB_KIND_UNINSTALL after the release payload is removed.
     *
     * @generated from protobuf enum value: APP_INSTALL_JOB_PHASE_UNINSTALLED = 12;
     */
    AppInstallJobPhase[AppInstallJobPhase["UNINSTALLED"] = 12] = "UNINSTALLED";
})(AppInstallJobPhase || (AppInstallJobPhase = {}));
/**
 * AppInstallJobState is the typed terminal/in-flight job state. It aligns with
 * the Platform P-NAPP-008 fail-closed projection: a failed install/update
 * never projects as success and always leaves a recoverable state.
 *
 * @generated from protobuf enum nimi.runtime.v1.AppInstallJobState
 */
export var AppInstallJobState;
(function (AppInstallJobState) {
    /**
     * @generated from protobuf enum value: APP_INSTALL_JOB_STATE_UNSPECIFIED = 0;
     */
    AppInstallJobState[AppInstallJobState["UNSPECIFIED"] = 0] = "UNSPECIFIED";
    /**
     * @generated from protobuf enum value: APP_INSTALL_JOB_STATE_QUEUED = 1;
     */
    AppInstallJobState[AppInstallJobState["QUEUED"] = 1] = "QUEUED";
    /**
     * @generated from protobuf enum value: APP_INSTALL_JOB_STATE_IN_PROGRESS = 2;
     */
    AppInstallJobState[AppInstallJobState["IN_PROGRESS"] = 2] = "IN_PROGRESS";
    /**
     * @generated from protobuf enum value: APP_INSTALL_JOB_STATE_INSTALLED = 3;
     */
    AppInstallJobState[AppInstallJobState["INSTALLED"] = 3] = "INSTALLED";
    /**
     * @generated from protobuf enum value: APP_INSTALL_JOB_STATE_FAILED = 4;
     */
    AppInstallJobState[AppInstallJobState["FAILED"] = 4] = "FAILED";
    /**
     * APP_INSTALL_JOB_STATE_CANCELLED is the terminal state of a job cancelled
     * through HealthRepairApp(action=cancel). A cancelled job is recoverable via
     * retry and is never projected as success.
     *
     * @generated from protobuf enum value: APP_INSTALL_JOB_STATE_CANCELLED = 5;
     */
    AppInstallJobState[AppInstallJobState["CANCELLED"] = 5] = "CANCELLED";
    /**
     * APP_INSTALL_JOB_STATE_UNINSTALLED is the terminal success state of an
     * uninstall lifecycle job (K-APP-017). It is reached only by a job of kind
     * APP_LIFECYCLE_JOB_KIND_UNINSTALL; a successful uninstall is never
     * projected as APP_INSTALL_JOB_STATE_INSTALLED.
     *
     * @generated from protobuf enum value: APP_INSTALL_JOB_STATE_UNINSTALLED = 6;
     */
    AppInstallJobState[AppInstallJobState["UNINSTALLED"] = 6] = "UNINSTALLED";
})(AppInstallJobState || (AppInstallJobState = {}));
/**
 * AppLifecycleJobKind distinguishes the lifecycle operation that produced a
 * job. Install, update, healthRepair, and uninstall jobs share the
 * AppInstallJob shape but carry a distinct kind so the consumer never infers
 * intent from phase.
 *
 * @generated from protobuf enum nimi.runtime.v1.AppLifecycleJobKind
 */
export var AppLifecycleJobKind;
(function (AppLifecycleJobKind) {
    /**
     * @generated from protobuf enum value: APP_LIFECYCLE_JOB_KIND_UNSPECIFIED = 0;
     */
    AppLifecycleJobKind[AppLifecycleJobKind["UNSPECIFIED"] = 0] = "UNSPECIFIED";
    /**
     * @generated from protobuf enum value: APP_LIFECYCLE_JOB_KIND_INSTALL = 1;
     */
    AppLifecycleJobKind[AppLifecycleJobKind["INSTALL"] = 1] = "INSTALL";
    /**
     * @generated from protobuf enum value: APP_LIFECYCLE_JOB_KIND_UPDATE = 2;
     */
    AppLifecycleJobKind[AppLifecycleJobKind["UPDATE"] = 2] = "UPDATE";
    /**
     * @generated from protobuf enum value: APP_LIFECYCLE_JOB_KIND_REPAIR = 3;
     */
    AppLifecycleJobKind[AppLifecycleJobKind["REPAIR"] = 3] = "REPAIR";
    /**
     * APP_LIFECYCLE_JOB_KIND_UNINSTALL marks a watchable uninstall lifecycle
     * job (K-APP-017). UninstallApp emits a typed AppInstallJob of this kind so
     * the `uninstalling` Apps card state has a single live-job truth source. An
     * uninstall job never carries the install digest/download phases; it runs
     * through the materialize phase (release payload removal) to the installed
     * (completed) terminal phase, and a failed uninstall is recoverable.
     *
     * @generated from protobuf enum value: APP_LIFECYCLE_JOB_KIND_UNINSTALL = 4;
     */
    AppLifecycleJobKind[AppLifecycleJobKind["UNINSTALL"] = 4] = "UNINSTALL";
})(AppLifecycleJobKind || (AppLifecycleJobKind = {}));
/**
 * AppHealthRepairAction is the typed health/repair action token. It admits
 * only the four S-APP-002 tokens; no other action is accepted.
 *
 * @generated from protobuf enum nimi.runtime.v1.AppHealthRepairAction
 */
export var AppHealthRepairAction;
(function (AppHealthRepairAction) {
    /**
     * @generated from protobuf enum value: APP_HEALTH_REPAIR_ACTION_UNSPECIFIED = 0;
     */
    AppHealthRepairAction[AppHealthRepairAction["UNSPECIFIED"] = 0] = "UNSPECIFIED";
    /**
     * @generated from protobuf enum value: APP_HEALTH_REPAIR_ACTION_CANCEL = 1;
     */
    AppHealthRepairAction[AppHealthRepairAction["CANCEL"] = 1] = "CANCEL";
    /**
     * @generated from protobuf enum value: APP_HEALTH_REPAIR_ACTION_RETRY = 2;
     */
    AppHealthRepairAction[AppHealthRepairAction["RETRY"] = 2] = "RETRY";
    /**
     * @generated from protobuf enum value: APP_HEALTH_REPAIR_ACTION_REPAIR = 3;
     */
    AppHealthRepairAction[AppHealthRepairAction["REPAIR"] = 3] = "REPAIR";
    /**
     * @generated from protobuf enum value: APP_HEALTH_REPAIR_ACTION_REINSTALL = 4;
     */
    AppHealthRepairAction[AppHealthRepairAction["REINSTALL"] = 4] = "REINSTALL";
})(AppHealthRepairAction || (AppHealthRepairAction = {}));
/**
 * AppInstallSourceKind distinguishes a bundled first-party install (no network
 * download; materialized from the atomic Nimi release bundle) from an external
 * immutable artifact install (HTTPS download + sha256 verification).
 *
 * @generated from protobuf enum nimi.runtime.v1.AppInstallSourceKind
 */
export var AppInstallSourceKind;
(function (AppInstallSourceKind) {
    /**
     * @generated from protobuf enum value: APP_INSTALL_SOURCE_KIND_UNSPECIFIED = 0;
     */
    AppInstallSourceKind[AppInstallSourceKind["UNSPECIFIED"] = 0] = "UNSPECIFIED";
    /**
     * @generated from protobuf enum value: APP_INSTALL_SOURCE_KIND_BUNDLED = 1;
     */
    AppInstallSourceKind[AppInstallSourceKind["BUNDLED"] = 1] = "BUNDLED";
    /**
     * @generated from protobuf enum value: APP_INSTALL_SOURCE_KIND_EXTERNAL_ARTIFACT = 2;
     */
    AppInstallSourceKind[AppInstallSourceKind["EXTERNAL_ARTIFACT"] = 2] = "EXTERNAL_ARTIFACT";
})(AppInstallSourceKind || (AppInstallSourceKind = {}));
/**
 * AppOpenFlowStep is the typed Open-flow step (K-APP-017). It surfaces the
 * concrete checkpoint the launch is at so a failed Open names the exact step
 * rather than a generic failure. It is never inferred.
 *
 * @generated from protobuf enum nimi.runtime.v1.AppOpenFlowStep
 */
export var AppOpenFlowStep;
(function (AppOpenFlowStep) {
    /**
     * @generated from protobuf enum value: APP_OPEN_FLOW_STEP_UNSPECIFIED = 0;
     */
    AppOpenFlowStep[AppOpenFlowStep["UNSPECIFIED"] = 0] = "UNSPECIFIED";
    /**
     * RESOLVE_REGISTRY resolves the admitted Nimi App registry row.
     *
     * @generated from protobuf enum value: APP_OPEN_FLOW_STEP_RESOLVE_REGISTRY = 1;
     */
    AppOpenFlowStep[AppOpenFlowStep["RESOLVE_REGISTRY"] = 1] = "RESOLVE_REGISTRY";
    /**
     * VERIFY_PACKAGE verifies the materialized release package + install
     * evidence (active release pointer, digest-verified payload).
     *
     * @generated from protobuf enum value: APP_OPEN_FLOW_STEP_VERIFY_PACKAGE = 2;
     */
    AppOpenFlowStep[AppOpenFlowStep["VERIFY_PACKAGE"] = 2] = "VERIFY_PACKAGE";
    /**
     * VERIFY_LIBRARY verifies the account app-library state for the app.
     *
     * @generated from protobuf enum value: APP_OPEN_FLOW_STEP_VERIFY_LIBRARY = 3;
     */
    AppOpenFlowStep[AppOpenFlowStep["VERIFY_LIBRARY"] = 3] = "VERIFY_LIBRARY";
    /**
     * VERIFY_APP_DATA verifies the durable app-data root state.
     *
     * @generated from protobuf enum value: APP_OPEN_FLOW_STEP_VERIFY_APP_DATA = 4;
     */
    AppOpenFlowStep[AppOpenFlowStep["VERIFY_APP_DATA"] = 4] = "VERIFY_APP_DATA";
    /**
     * VERIFY_PERMISSIONS verifies the app permissions are granted or
     * promptable.
     *
     * @generated from protobuf enum value: APP_OPEN_FLOW_STEP_VERIFY_PERMISSIONS = 5;
     */
    AppOpenFlowStep[AppOpenFlowStep["VERIFY_PERMISSIONS"] = 5] = "VERIFY_PERMISSIONS";
    /**
     * ENSURE_AICONFIG ensures the app-scope AIConfig exists (first-launch
     * initialization per S-AICONF-009).
     *
     * @generated from protobuf enum value: APP_OPEN_FLOW_STEP_ENSURE_AICONFIG = 6;
     */
    AppOpenFlowStep[AppOpenFlowStep["ENSURE_AICONFIG"] = 6] = "ENSURE_AICONFIG";
    /**
     * VALIDATE_MANIFEST validates the app manifest requirements.
     *
     * @generated from protobuf enum value: APP_OPEN_FLOW_STEP_VALIDATE_MANIFEST = 7;
     */
    AppOpenFlowStep[AppOpenFlowStep["VALIDATE_MANIFEST"] = 7] = "VALIDATE_MANIFEST";
    /**
     * LAUNCH is the terminal launch step: the runtime-owned app launch
     * supervision admits the app process/surface.
     *
     * @generated from protobuf enum value: APP_OPEN_FLOW_STEP_LAUNCH = 8;
     */
    AppOpenFlowStep[AppOpenFlowStep["LAUNCH"] = 8] = "LAUNCH";
})(AppOpenFlowStep || (AppOpenFlowStep = {}));
/**
 * AppOpenState is the typed terminal Open-flow state. A blocked or failed
 * Open never projects as launched.
 *
 * @generated from protobuf enum nimi.runtime.v1.AppOpenState
 */
export var AppOpenState;
(function (AppOpenState) {
    /**
     * @generated from protobuf enum value: APP_OPEN_STATE_UNSPECIFIED = 0;
     */
    AppOpenState[AppOpenState["UNSPECIFIED"] = 0] = "UNSPECIFIED";
    /**
     * APP_OPEN_STATE_LAUNCHED means the Open flow completed and the app launch
     * was admitted.
     *
     * @generated from protobuf enum value: APP_OPEN_STATE_LAUNCHED = 1;
     */
    AppOpenState[AppOpenState["LAUNCHED"] = 1] = "LAUNCHED";
    /**
     * APP_OPEN_STATE_BLOCKED means a verify step fail-closed before launch
     * (package/library/app-data/permission/AIConfig/manifest). It carries the
     * distinct typed reason_code; it is never collapsed into a generic value.
     *
     * @generated from protobuf enum value: APP_OPEN_STATE_BLOCKED = 2;
     */
    AppOpenState[AppOpenState["BLOCKED"] = 2] = "BLOCKED";
})(AppOpenState || (AppOpenState = {}));
// @generated message type with reflection information, may provide speed optimized methods
class SendAppMessageRequest$Type extends MessageType {
    constructor() {
        super("nimi.runtime.v1.SendAppMessageRequest", [
            { no: 1, name: "from_app_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 2, name: "to_app_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 3, name: "subject_user_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 4, name: "message_type", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 5, name: "payload", kind: "message", T: () => Struct },
            { no: 6, name: "require_ack", kind: "scalar", T: 8 /*ScalarType.BOOL*/ },
            { no: 7, name: "scoped_binding", kind: "message", T: () => ScopedRuntimeBindingAttachment }
        ]);
    }
    create(value) {
        const message = globalThis.Object.create((this.messagePrototype));
        message.fromAppId = "";
        message.toAppId = "";
        message.subjectUserId = "";
        message.messageType = "";
        message.requireAck = false;
        if (value !== undefined)
            reflectionMergePartial(this, message, value);
        return message;
    }
    internalBinaryRead(reader, length, options, target) {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* string from_app_id */ 1:
                    message.fromAppId = reader.string();
                    break;
                case /* string to_app_id */ 2:
                    message.toAppId = reader.string();
                    break;
                case /* string subject_user_id */ 3:
                    message.subjectUserId = reader.string();
                    break;
                case /* string message_type */ 4:
                    message.messageType = reader.string();
                    break;
                case /* google.protobuf.Struct payload */ 5:
                    message.payload = Struct.internalBinaryRead(reader, reader.uint32(), options, message.payload);
                    break;
                case /* bool require_ack */ 6:
                    message.requireAck = reader.bool();
                    break;
                case /* nimi.runtime.v1.ScopedRuntimeBindingAttachment scoped_binding */ 7:
                    message.scopedBinding = ScopedRuntimeBindingAttachment.internalBinaryRead(reader, reader.uint32(), options, message.scopedBinding);
                    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, writer, options) {
        /* string from_app_id = 1; */
        if (message.fromAppId !== "")
            writer.tag(1, WireType.LengthDelimited).string(message.fromAppId);
        /* string to_app_id = 2; */
        if (message.toAppId !== "")
            writer.tag(2, WireType.LengthDelimited).string(message.toAppId);
        /* string subject_user_id = 3; */
        if (message.subjectUserId !== "")
            writer.tag(3, WireType.LengthDelimited).string(message.subjectUserId);
        /* string message_type = 4; */
        if (message.messageType !== "")
            writer.tag(4, WireType.LengthDelimited).string(message.messageType);
        /* google.protobuf.Struct payload = 5; */
        if (message.payload)
            Struct.internalBinaryWrite(message.payload, writer.tag(5, WireType.LengthDelimited).fork(), options).join();
        /* bool require_ack = 6; */
        if (message.requireAck !== false)
            writer.tag(6, WireType.Varint).bool(message.requireAck);
        /* nimi.runtime.v1.ScopedRuntimeBindingAttachment scoped_binding = 7; */
        if (message.scopedBinding)
            ScopedRuntimeBindingAttachment.internalBinaryWrite(message.scopedBinding, writer.tag(7, 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 nimi.runtime.v1.SendAppMessageRequest
 */
export const SendAppMessageRequest = new SendAppMessageRequest$Type();
// @generated message type with reflection information, may provide speed optimized methods
class SendAppMessageResponse$Type extends MessageType {
    constructor() {
        super("nimi.runtime.v1.SendAppMessageResponse", [
            { no: 1, name: "message_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 2, name: "accepted", kind: "scalar", T: 8 /*ScalarType.BOOL*/ },
            { no: 3, name: "reason_code", kind: "enum", T: () => ["nimi.runtime.v1.ReasonCode", ReasonCode] }
        ]);
    }
    create(value) {
        const message = globalThis.Object.create((this.messagePrototype));
        message.messageId = "";
        message.accepted = false;
        message.reasonCode = 0;
        if (value !== undefined)
            reflectionMergePartial(this, message, value);
        return message;
    }
    internalBinaryRead(reader, length, options, target) {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* string message_id */ 1:
                    message.messageId = reader.string();
                    break;
                case /* bool accepted */ 2:
                    message.accepted = reader.bool();
                    break;
                case /* nimi.runtime.v1.ReasonCode reason_code */ 3:
                    message.reasonCode = reader.int32();
                    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, writer, options) {
        /* string message_id = 1; */
        if (message.messageId !== "")
            writer.tag(1, WireType.LengthDelimited).string(message.messageId);
        /* bool accepted = 2; */
        if (message.accepted !== false)
            writer.tag(2, WireType.Varint).bool(message.accepted);
        /* nimi.runtime.v1.ReasonCode reason_code = 3; */
        if (message.reasonCode !== 0)
            writer.tag(3, WireType.Varint).int32(message.reasonCode);
        let u = options.writeUnknownFields;
        if (u !== false)
            (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
        return writer;
    }
}
/**
 * @generated MessageType for protobuf message nimi.runtime.v1.SendAppMessageResponse
 */
export const SendAppMessageResponse = new SendAppMessageResponse$Type();
// @generated message type with reflection information, may provide speed optimized methods
class SubscribeAppMessagesRequest$Type extends MessageType {
    constructor() {
        super("nimi.runtime.v1.SubscribeAppMessagesRequest", [
            { no: 1, name: "app_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 2, name: "subject_user_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 3, name: "cursor", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 4, name: "from_app_ids", kind: "scalar", repeat: 2 /*RepeatType.UNPACKED*/, T: 9 /*ScalarType.STRING*/ },
            { no: 5, name: "scoped_binding", kind: "message", T: () => ScopedRuntimeBindingAttachment }
        ]);
    }
    create(value) {
        const message = globalThis.Object.create((this.messagePrototype));
        message.appId = "";
        message.subjectUserId = "";
        message.cursor = "";
        message.fromAppIds = [];
        if (value !== undefined)
            reflectionMergePartial(this, message, value);
        return message;
    }
    internalBinaryRead(reader, length, options, target) {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* string app_id */ 1:
                    message.appId = reader.string();
                    break;
                case /* string subject_user_id */ 2:
                    message.subjectUserId = reader.string();
                    break;
                case /* string cursor */ 3:
                    message.cursor = reader.string();
                    break;
                case /* repeated string from_app_ids */ 4:
                    message.fromAppIds.push(reader.string());
                    break;
                case /* nimi.runtime.v1.ScopedRuntimeBindingAttachment scoped_binding */ 5:
                    message.scopedBinding = ScopedRuntimeBindingAttachment.internalBinaryRead(reader, reader.uint32(), options, message.scopedBinding);
                    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, writer, options) {
        /* string app_id = 1; */
        if (message.appId !== "")
            writer.tag(1, WireType.LengthDelimited).string(message.appId);
        /* string subject_user_id = 2; */
        if (message.subjectUserId !== "")
            writer.tag(2, WireType.LengthDelimited).string(message.subjectUserId);
        /* string cursor = 3; */
        if (message.cursor !== "")
            writer.tag(3, WireType.LengthDelimited).string(message.cursor);
        /* repeated string from_app_ids = 4; */
        for (let i = 0; i < message.fromAppIds.length; i++)
            writer.tag(4, WireType.LengthDelimited).string(message.fromAppIds[i]);
        /* nimi.runtime.v1.ScopedRuntimeBindingAttachment scoped_binding = 5; */
        if (message.scopedBinding)
            ScopedRuntimeBindingAttachment.internalBinaryWrite(message.scopedBinding, 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 nimi.runtime.v1.SubscribeAppMessagesRequest
 */
export const SubscribeAppMessagesRequest = new SubscribeAppMessagesRequest$Type();
// @generated message type with reflection information, may provide speed optimized methods
class AppMessageEvent$Type extends MessageType {
    constructor() {
        super("nimi.runtime.v1.AppMessageEvent", [
            { no: 1, name: "event_type", kind: "enum", T: () => ["nimi.runtime.v1.AppMessageEventType", AppMessageEventType] },
            { no: 2, name: "sequence", kind: "scalar", T: 4 /*ScalarType.UINT64*/ },
            { no: 3, name: "message_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 4, name: "from_app_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 5, name: "to_app_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 6, name: "subject_user_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 7, name: "message_type", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 8, name: "payload", kind: "message", T: () => Struct },
            { no: 9, name: "reason_code", kind: "enum", T: () => ["nimi.runtime.v1.ReasonCode", ReasonCode] },
            { no: 10, name: "trace_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 11, name: "timestamp", kind: "message", T: () => Timestamp }
        ]);
    }
    create(value) {
        const message = globalThis.Object.create((this.messagePrototype));
        message.eventType = 0;
        message.sequence = "0";
        message.messageId = "";
        message.fromAppId = "";
        message.toAppId = "";
        message.subjectUserId = "";
        message.messageType = "";
        message.reasonCode = 0;
        message.traceId = "";
        if (value !== undefined)
            reflectionMergePartial(this, message, value);
        return message;
    }
    internalBinaryRead(reader, length, options, target) {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* nimi.runtime.v1.AppMessageEventType event_type */ 1:
                    message.eventType = reader.int32();
                    break;
                case /* uint64 sequence */ 2:
                    message.sequence = reader.uint64().toString();
                    break;
                case /* string message_id */ 3:
                    message.messageId = reader.string();
                    break;
                case /* string from_app_id */ 4:
                    message.fromAppId = reader.string();
                    break;
                case /* string to_app_id */ 5:
                    message.toAppId = reader.string();
                    break;
                case /* string subject_user_id */ 6:
                    message.subjectUserId = reader.string();
                    break;
                case /* string message_type */ 7:
                    message.messageType = reader.string();
                    break;
                case /* google.protobuf.Struct payload */ 8:
                    message.payload = Struct.internalBinaryRead(reader, reader.uint32(), options, message.payload);
                    break;
                case /* nimi.runtime.v1.ReasonCode reason_code */ 9:
                    message.reasonCode = reader.int32();
                    break;
                case /* string trace_id */ 10:
                    message.traceId = reader.string();
                    break;
                case /* google.protobuf.Timestamp timestamp */ 11:
                    message.timestamp = Timestamp.internalBinaryRead(reader, reader.uint32(), options, message.timestamp);
                    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, writer, options) {
        /* nimi.runtime.v1.AppMessageEventType event_type = 1; */
        if (message.eventType !== 0)
            writer.tag(1, WireType.Varint).int32(message.eventType);
        /* uint64 sequence = 2; */
        if (message.sequence !== "0")
            writer.tag(2, WireType.Varint).uint64(message.sequence);
        /* string message_id = 3; */
        if (message.messageId !== "")
            writer.tag(3, WireType.LengthDelimited).string(message.messageId);
        /* string from_app_id = 4; */
        if (message.fromAppId !== "")
            writer.tag(4, WireType.LengthDelimited).string(message.fromAppId);
        /* string to_app_id = 5; */
        if (message.toAppId !== "")
            writer.tag(5, WireType.LengthDelimited).string(message.toAppId);
        /* string subject_user_id = 6; */
        if (message.subjectUserId !== "")
            writer.tag(6, WireType.LengthDelimited).string(message.subjectUserId);
        /* string message_type = 7; */
        if (message.messageType !== "")
            writer.tag(7, WireType.LengthDelimited).string(message.messageType);
        /* google.protobuf.Struct payload = 8; */
        if (message.payload)
            Struct.internalBinaryWrite(message.payload, writer.tag(8, WireType.LengthDelimited).fork(), options).join();
        /* nimi.runtime.v1.ReasonCode reason_code = 9; */
        if (message.reasonCode !== 0)
            writer.tag(9, WireType.Varint).int32(message.reasonCode);
        /* string trace_id = 10; */
        if (message.traceId !== "")
            writer.tag(10, WireType.LengthDelimited).string(message.traceId);
        /* google.protobuf.Timestamp timestamp = 11; */
        if (message.timestamp)
            Timestamp.internalBinaryWrite(message.timestamp, writer.tag(11, 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 nimi.runtime.v1.AppMessageEvent
 */
export const AppMessageEvent = new AppMessageEvent$Type();
// @generated message type with reflection information, may provide speed optimized methods
class AppInstallStorageProjection$Type extends MessageType {
    constructor() {
        super("nimi.runtime.v1.AppInstallStorageProjection", [
            { no: 1, name: "app_root", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 2, name: "release_root", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 3, name: "durable_data_root", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 4, name: "cache_root", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 5, name: "temp_root", kind: "scalar", T: 9 /*ScalarType.STRING*/ }
        ]);
    }
    create(value) {
        const message = globalThis.Object.create((this.messagePrototype));
        message.appRoot = "";
        message.releaseRoot = "";
        message.durableDataRoot = "";
        message.cacheRoot = "";
        message.tempRoot = "";
        if (value !== undefined)
            reflectionMergePartial(this, message, value);
        return message;
    }
    internalBinaryRead(reader, length, options, target) {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* string app_root */ 1:
                    message.appRoot = reader.string();
                    break;
                case /* string release_root */ 2:
                    message.releaseRoot = reader.string();
                    break;
                case /* string durable_data_root */ 3:
                    message.durableDataRoot = reader.string();
                    break;
                case /* string cache_root */ 4:
                    message.cacheRoot = reader.string();
                    break;
                case /* string temp_root */ 5:
                    message.tempRoot = 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, writer, options) {
        /* string app_root = 1; */
        if (message.appRoot !== "")
            writer.tag(1, WireType.LengthDelimited).string(message.appRoot);
        /* string release_root = 2; */
        if (message.releaseRoot !== "")
            writer.tag(2, WireType.LengthDelimited).string(message.releaseRoot);
        /* string durable_data_root = 3; */
        if (message.durableDataRoot !== "")
            writer.tag(3, WireType.LengthDelimited).string(message.durableDataRoot);
        /* string cache_root = 4; */
        if (message.cacheRoot !== "")
            writer.tag(4, WireType.LengthDelimited).string(message.cacheRoot);
        /* string temp_root = 5; */
        if (message.tempRoot !== "")
            writer.tag(5, WireType.LengthDelimited).string(message.tempRoot);
        let u = options.writeUnknownFields;
        if (u !== false)
            (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
        return writer;
    }
}
/**
 * @generated MessageType for protobuf message nimi.runtime.v1.AppInstallStorageProjection
 */
export const AppInstallStorageProjection = new AppInstallStorageProjection$Type();
// @generated message type with reflection information, may provide speed optimized methods
class AppInstallJob$Type extends MessageType {
    constructor() {
        super("nimi.runtime.v1.AppInstallJob", [
            { no: 1, name: "job_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 2, name: "app_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 3, name: "release_descriptor_ref", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 4, name: "installed_version", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 5, name: "state", kind: "enum", T: () => ["nimi.runtime.v1.AppInstallJobState", AppInstallJobState, "APP_INSTALL_JOB_STATE_"] },
            { no: 6, name: "phase", kind: "enum", T: () => ["nimi.runtime.v1.AppInstallJobPhase", AppInstallJobPhase, "APP_INSTALL_JOB_PHASE_"] },
            { no: 7, name: "source_kind", kind: "enum", T: () => ["nimi.runtime.v1.AppInstallSourceKind", AppInstallSourceKind, "APP_INSTALL_SOURCE_KIND_"] },
            { no: 8, name: "sha256", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 9, name: "artifact_bytes", kind: "scalar", T: 3 /*ScalarType.INT64*/ },
            { no: 10, name: "storage", kind: "message", T: () => AppInstallStorageProjection },
            { no: 11, name: "reason_code", kind: "enum", T: () => ["nimi.runtime.v1.ReasonCode", ReasonCode] },
            { no: 12, name: "failure_detail", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 13, name: "retryable", kind: "scalar", T: 8 /*ScalarType.BOOL*/ },
            { no: 14, name: "created_at", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 15, name: "updated_at", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 16, name: "kind", kind: "enum", T: () => ["nimi.runtime.v1.AppLifecycleJobKind", AppLifecycleJobKind, "APP_LIFECYCLE_JOB_KIND_"] },
            { no: 17, name: "previous_version", kind: "scalar", T: 9 /*ScalarType.STRING*/ }
        ]);
    }
    create(value) {
        const message = globalThis.Object.create((this.messagePrototype));
        message.jobId = "";
        message.appId = "";
        message.releaseDescriptorRef = "";
        message.installedVersion = "";
        message.state = 0;
        message.phase = 0;
        message.sourceKind = 0;
        message.sha256 = "";
        message.artifactBytes = "0";
        message.reasonCode = 0;
        message.failureDetail = "";
        message.retryable = false;
        message.createdAt = "";
        message.updatedAt = "";
        message.kind = 0;
        message.previousVersion = "";
        if (value !== undefined)
            reflectionMergePartial(this, message, value);
        return message;
    }
    internalBinaryRead(reader, length, options, target) {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* string job_id */ 1:
                    message.jobId = reader.string();
                    break;
                case /* string app_id */ 2:
                    message.appId = reader.string();
                    break;
                case /* string release_descriptor_ref */ 3:
                    message.releaseDescriptorRef = reader.string();
                    break;
                case /* string installed_version */ 4:
                    message.installedVersion = reader.string();
                    break;
                case /* nimi.runtime.v1.AppInstallJobState state */ 5:
                    message.state = reader.int32();
                    break;
                case /* nimi.runtime.v1.AppInstallJobPhase phase */ 6:
                    message.phase = reader.int32();
                    break;
                case /* nimi.runtime.v1.AppInstallSourceKind source_kind */ 7:
                    message.sourceKind = reader.int32();
                    break;
                case /* string sha256 */ 8:
                    message.sha256 = reader.string();
                    break;
                case /* int64 artifact_bytes */ 9:
                    message.artifactBytes = reader.int64().toString();
                    break;
                case /* nimi.runtime.v1.AppInstallStorageProjection storage */ 10:
                    message.storage = AppInstallStorageProjection.internalBinaryRead(reader, reader.uint32(), options, message.storage);
                    break;
                case /* nimi.runtime.v1.ReasonCode reason_code */ 11:
                    message.reasonCode = reader.int32();
                    break;
                case /* string failure_detail */ 12:
                    message.failureDetail = reader.string();
                    break;
                case /* bool retryable */ 13:
                    message.retryable = reader.bool();
                    break;
                case /* string created_at */ 14:
                    message.createdAt = reader.string();
                    break;
                case /* string updated_at */ 15:
                    message.updatedAt = reader.string();
                    break;
                case /* nimi.runtime.v1.AppLifecycleJobKind kind */ 16:
                    message.kind = reader.int32();
                    break;
                case /* string previous_version */ 17:
                    message.previousVersion = 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, writer, options) {
        /* string job_id = 1; */
        if (message.jobId !== "")
            writer.tag(1, WireType.LengthDelimited).string(message.jobId);
        /* string app_id = 2; */
        if (message.appId !== "")
            writer.tag(2, WireType.LengthDelimited).string(message.appId);
        /* string release_descriptor_ref = 3; */
        if (message.releaseDescriptorRef !== "")
            writer.tag(3, WireType.LengthDelimited).string(message.releaseDescriptorRef);
        /* string installed_version = 4; */
        if (message.installedVersion !== "")
            writer.tag(4, WireType.LengthDelimited).string(message.installedVersion);
        /* nimi.runtime.v1.AppInstallJobState state = 5; */
        if (message.state !== 0)
            writer.tag(5, WireType.Varint).int32(message.state);
        /* nimi.runtime.v1.AppInstallJobPhase phase = 6; */
        if (message.phase !== 0)
            writer.tag(6, WireType.Varint).int32(message.phase);
        /* nimi.runtime.v1.AppInstallSourceKind source_kind = 7; */
        if (message.sourceKind !== 0)
            writer.tag(7, WireType.Varint).int32(message.sourceKind);
        /* string sha256 = 8; */
        if (message.sha256 !== "")
            writer.tag(8, WireType.LengthDelimited).string(message.sha256);
        /* int64 artifact_bytes = 9; */
        if (message.artifactBytes !== "0")
            writer.tag(9, WireType.Varint).int64(message.artifactBytes);
        /* nimi.runtime.v1.AppInstallStorageProjection storage = 10; */
        if (message.storage)
            AppInstallStorageProjection.internalBinaryWrite(message.storage, writer.tag(10, WireType.LengthDelimited).fork(), options).join();
        /* nimi.runtime.v1.ReasonCode reason_code = 11; */
        if (message.reasonCode !== 0)
            writer.tag(11, WireType.Varint).int32(message.reasonCode);
        /* string failure_detail = 12; */
        if (message.failureDetail !== "")
            writer.tag(12, WireType.LengthDelimited).string(message.failureDetail);
        /* bool retryable = 13; */
        if (message.retryable !== false)
            writer.tag(13, WireType.Varint).bool(message.retryable);
        /* string created_at = 14; */
        if (message.createdAt !== "")
            writer.tag(14, WireType.LengthDelimited).string(message.createdAt);
        /* string updated_at = 15; */
        if (message.updatedAt !== "")
            writer.tag(15, WireType.LengthDelimited).string(message.updatedAt);
        /* nimi.runtime.v1.AppLifecycleJobKind kind = 16; */
        if (message.kind !== 0)
            writer.tag(16, WireType.Varint).int32(message.kind);
        /* string previous_version = 17; */
        if (message.previousVersion !== "")
            writer.tag(17, WireType.LengthDelimited).string(message.previousVersion);
        let u = options.writeUnknownFields;
        if (u !== false)
            (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
        return writer;
    }
}
/**
 * @generated MessageType for protobuf message nimi.runtime.v1.AppInstallJob
 */
export const AppInstallJob = new AppInstallJob$Type();
// @generated message type with reflection information, may provide speed optimized methods
class InstallAppRequest$Type extends MessageType {
    constructor() {
        super("nimi.runtime.v1.InstallAppRequest", [
            { no: 1, name: "app_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 2, name: "confirmed", kind: "scalar", T: 8 /*ScalarType.BOOL*/ }
        ]);
    }
    create(value) {
        const message = globalThis.Object.create((this.messagePrototype));
        message.appId = "";
        message.confirmed = false;
        if (value !== undefined)
            reflectionMergePartial(this, message, value);
        return message;
    }
    internalBinaryRead(reader, length, options, target) {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* string app_id */ 1:
                    message.appId = reader.string();
                    break;
                case /* bool confirmed */ 2:
                    message.confirmed = reader.bool();
                    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, writer, options) {
        /* string app_id = 1; */
        if (message.appId !== "")
            writer.tag(1, WireType.LengthDelimited).string(message.appId);
        /* bool confirmed = 2; */
        if (message.confirmed !== false)
            writer.tag(2, WireType.Varint).bool(message.confirmed);
        let u = options.writeUnknownFields;
        if (u !== false)
            (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
        return writer;
    }
}
/**
 * @generated MessageType for protobuf message nimi.runtime.v1.InstallAppRequest
 */
export const InstallAppRequest = new InstallAppRequest$Type();
// @generated message type with reflection information, may provide speed optimized methods
class InstallAppResponse$Type extends MessageType {
    constructor() {
        super("nimi.runtime.v1.InstallAppResponse", [
            { no: 1, name: "job", kind: "message", T: () => AppInstallJob }
        ]);
    }
    create(value) {
        const message = globalThis.Object.create((this.messagePrototype));
        if (value !== undefined)
            reflectionMergePartial(this, message, value);
        return message;
    }
    internalBinaryRead(reader, length, options, target) {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* nimi.runtime.v1.AppInstallJob job */ 1:
                    message.job = AppInstallJob.internalBinaryRead(reader, reader.uint32(), options, message.job);
                    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, writer, options) {
        /* nimi.runtime.v1.AppInstallJob job = 1; */
        if (message.job)
            AppInstallJob.internalBinaryWrite(message.job, 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 nimi.runtime.v1.InstallAppResponse
 */
export const InstallAppResponse = new InstallAppResponse$Type();
// @generated message type with reflection information, may provide speed optimized methods
class GetAppInstallJobRequest$Type extends MessageType {
    constructor() {
        super("nimi.runtime.v1.GetAppInstallJobRequest", [
            { no: 1, name: "job_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ }
        ]);
    }
    create(value) {
        const message = globalThis.Object.create((this.messagePrototype));
        message.jobId = "";
        if (value !== undefined)
            reflectionMergePartial(this, message, value);
        return message;
    }
    internalBinaryRead(reader, length, options, target) {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* string job_id */ 1:
                    message.jobId = 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, writer, options) {
        /* string job_id = 1; */
        if (message.jobId !== "")
            writer.tag(1, WireType.LengthDelimited).string(message.jobId);
        let u = options.writeUnknownFields;
        if (u !== false)
            (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
        return writer;
    }
}
/**
 * @generated MessageType for protobuf message nimi.runtime.v1.GetAppInstallJobRequest
 */
export const GetAppInstallJobRequest = new GetAppInstallJobRequest$Type();
// @generated message type with reflection information, may provide speed optimized methods
class GetAppInstallJobResponse$Type extends MessageType {
    constructor() {
        super("nimi.runtime.v1.GetAppInstallJobResponse", [
            { no: 1, name: "job", kind: "message", T: () => AppInstallJob }
        ]);
    }
    create(value) {
        const message = globalThis.Object.create((this.messagePrototype));
        if (value !== undefined)
            reflectionMergePartial(this, message, value);
        return message;
    }
    internalBinaryRead(reader, length, options, target) {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* nimi.runtime.v1.AppInstallJob job */ 1:
                    message.job = AppInstallJob.internalBinaryRead(reader, reader.uint32(), options, message.job);
                    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, writer, options) {
        /* nimi.runtime.v1.AppInstallJob job = 1; */
        if (message.job)
            AppInstallJob.internalBinaryWrite(message.job, 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 nimi.runtime.v1.GetAppInstallJobResponse
 */
export const GetAppInstallJobResponse = new GetAppInstallJobResponse$Type();
// @generated message type with reflection information, may provide speed optimized methods
class ListAppInstallJobsRequest$Type extends MessageType {
    constructor() {
        super("nimi.runtime.v1.ListAppInstallJobsRequest", [
            { no: 1, name: "app_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ }
        ]);
    }
    create(value) {
        const message = globalThis.Object.create((this.messagePrototype));
        message.appId = "";
        if (value !== undefined)
            reflectionMergePartial(this, message, value);
        return message;
    }
    internalBinaryRead(reader, length, options, target) {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* string app_id */ 1:
                    message.appId = 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, writer, options) {
        /* string app_id = 1; */
        if (message.appId !== "")
            writer.tag(1, WireType.LengthDelimited).string(message.appId);
        let u = options.writeUnknownFields;
        if (u !== false)
            (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
        return writer;
    }
}
/**
 * @generated MessageType for protobuf message nimi.runtime.v1.ListAppInstallJobsRequest
 */
export const ListAppInstallJobsRequest = new ListAppInstallJobsRequest$Type();
// @generated message type with reflection information, may provide speed optimized methods
class ListAppInstallJobsResponse$Type extends MessageType {
    constructor() {
        super("nimi.runtime.v1.ListAppInstallJobsResponse", [
            { no: 1, name: "jobs", kind: "message", repeat: 2 /*RepeatType.UNPACKED*/, T: () => AppInstallJob }
        ]);
    }
    create(value) {
        const message = globalThis.Object.create((this.messagePrototype));
        message.jobs = [];
        if (value !== undefined)
            reflectionMergePartial(this, message, value);
        return message;
    }
    internalBinaryRead(reader, length, options, target) {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* repeated nimi.runtime.v1.AppInstallJob jobs */ 1:
                    message.jobs.push(AppInstallJob.internalBinaryRead(reader, reader.uint32(), options));
                    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, writer, options) {
        /* repeated nimi.runtime.v1.AppInstallJob jobs = 1; */
        for (let i = 0; i < message.jobs.length; i++)
            AppInstallJob.internalBinaryWrite(message.jobs[i], 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 nimi.runtime.v1.ListAppInstallJobsResponse
 */
export const ListAppInstallJobsResponse = new ListAppInstallJobsResponse$Type();
// @generated message type with reflection information, may provide speed optimized methods
class WatchAppInstallJobEventsRequest$Type extends MessageType {
    constructor() {
        super("nimi.runtime.v1.WatchAppInstallJobEventsRequest", [
            { no: 1, name: "job_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ }
        ]);
    }
    create(value) {
        const message = globalThis.Object.create((this.messagePrototype));
        message.jobId = "";
        if (value !== undefined)
            reflectionMergePartial(this, message, value);
        return message;
    }
    internalBinaryRead(reader, length, options, target) {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* string job_id */ 1:
                    message.jobId = 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, writer, options) {
        /* string job_id = 1; */
        if (message.jobId !== "")
            writer.tag(1, WireType.LengthDelimited).string(message.jobId);
        let u = options.writeUnknownFields;
        if (u !== false)
            (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
        return writer;
    }
}
/**
 * @generated MessageType for protobuf message nimi.runtime.v1.WatchAppInstallJobEventsRequest
 */
export const WatchAppInstallJobEventsRequest = new WatchAppInstallJobEventsRequest$Type();
// @generated message type with reflection information, may provide speed optimized methods
class AppInstallJobEvent$Type extends MessageType {
    constructor() {
        super("nimi.runtime.v1.AppInstallJobEvent", [
            { no: 1, name: "sequence", kind: "scalar", T: 4 /*ScalarType.UINT64*/ },
            { no: 2, name: "job", kind: "message", T: () => AppInstallJob },
            { no: 3, name: "timestamp", kind: "message", T: () => Timestamp }
        ]);
    }
    create(value) {
        const message = globalThis.Object.create((this.messagePrototype));
        message.sequence = "0";
        if (value !== undefined)
            reflectionMergePartial(this, message, value);
        return message;
    }
    internalBinaryRead(reader, length, options, target) {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* uint64 sequence */ 1:
                    message.sequence = reader.uint64().toString();
                    break;
                case /* nimi.runtime.v1.AppInstallJob job */ 2:
                    message.job = AppInstallJob.internalBinaryRead(reader, reader.uint32(), options, message.job);
                    break;
                case /* google.protobuf.Timestamp timestamp */ 3:
                    message.timestamp = Timestamp.internalBinaryRead(reader, reader.uint32(), options, message.timestamp);
                    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, writer, options) {
        /* uint64 sequence = 1; */
        if (message.sequence !== "0")
            writer.tag(1, WireType.Varint).uint64(message.sequence);
        /* nimi.runtime.v1.AppInstallJob job = 2; */
        if (message.job)
            AppInstallJob.internalBinaryWrite(message.job, writer.tag(2, WireType.LengthDelimited).fork(), options).join();
        /* google.protobuf.Timestamp timestamp = 3; */
        if (message.timestamp)
            Timestamp.internalBinaryWrite(message.timestamp, 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 nimi.runtime.v1.AppInstallJobEvent
 */
export const AppInstallJobEvent = new AppInstallJobEvent$Type();
// @generated message type with reflection information, may provide speed optimized methods
class UninstallAppRequest$Type extends MessageType {
    constructor() {
        super("nimi.runtime.v1.UninstallAppRequest", [
            { no: 1, name: "app_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 2, name: "delete_durable_data", kind: "scalar", T: 8 /*ScalarType.BOOL*/ },
            { no: 3, name: "destructive_data_delete_confirmed", kind: "scalar", T: 8 /*ScalarType.BOOL*/ }
        ]);
    }
    create(value) {
        const message = globalThis.Object.create((this.messagePrototype));
        message.appId = "";
        message.deleteDurableData = false;
        message.destructiveDataDeleteConfirmed = false;
        if (value !== undefined)
            reflectionMergePartial(this, message, value);
        return message;
    }
    internalBinaryRead(reader, length, options, target) {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* string app_id */ 1:
                    message.appId = reader.string();
                    break;
                case /* bool delete_durable_data */ 2:
                    message.deleteDurableData = reader.bool();
                    break;
                case /* bool destructive_data_delete_confirmed */ 3:
                    message.destructiveDataDeleteConfirmed = reader.bool();
                    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, writer, options) {
        /* string app_id = 1; */
        if (message.appId !== "")
            writer.tag(1, WireType.LengthDelimited).string(message.appId);
        /* bool delete_durable_data = 2; */
        if (message.deleteDurableData !== false)
            writer.tag(2, WireType.Varint).bool(message.deleteDurableData);
        /* bool destructive_data_delete_confirmed = 3; */
        if (message.destructiveDataDeleteConfirmed !== false)
            writer.tag(3, WireType.Varint).bool(message.destructiveDataDeleteConfirmed);
        let u = options.writeUnknownFields;
        if (u !== false)
            (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
        return writer;
    }
}
/**
 * @generated MessageType for protobuf message nimi.runtime.v1.UninstallAppRequest
 */
export const UninstallAppRequest = new UninstallAppRequest$Type();
// @generated message type with reflection information, may provide speed optimized methods
class AppUninstallResult$Type extends MessageType {
    constructor() {
        super("nimi.runtime.v1.AppUninstallResult", [
            { no: 1, name: "app_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 2, name: "release_removed", kind: "scalar", T: 8 /*ScalarType.BOOL*/ },
            { no: 3, name: "durable_data_removed", kind: "scalar", T: 8 /*ScalarType.BOOL*/ },
            { no: 4, name: "storage", kind: "message", T: () => AppInstallStorageProjection },
            { no: 5, name: "reason_code", kind: "enum", T: () => ["nimi.runtime.v1.ReasonCode", ReasonCode] }
        ]);
    }
    create(value) {
        const message = globalThis.Object.create((this.messagePrototype));
        message.appId = "";
        message.releaseRemoved = false;
        message.durableDataRemoved = false;
        message.reasonCode = 0;
        if (value !== undefined)
            reflectionMergePartial(this, message, value);
        return message;
    }
    internalBinaryRead(reader, length, options, target) {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* string app_id */ 1:
                    message.appId = reader.string();
                    break;
                case /* bool release_removed */ 2:
                    message.releaseRemoved = reader.bool();
                    break;
                case /* bool durable_data_removed */ 3:
                    message.durableDataRemoved = reader.bool();
                    break;
                case /* nimi.runtime.v1.AppInstallStorageProjection storage */ 4:
                    message.storage = AppInstallStorageProjection.internalBinaryRead(reader, reader.uint32(), options, message.storage);
                    break;
                case /* nimi.runtime.v1.ReasonCode reason_code */ 5:
                    message.reasonCode = reader.int32();
                    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, writer, options) {
        /* string app_id = 1; */
        if (message.appId !== "")
            writer.tag(1, WireType.LengthDelimited).string(message.appId);
        /* bool release_removed = 2; */
        if (message.releaseRemoved !== false)
            writer.tag(2, WireType.Varint).bool(message.releaseRemoved);
        /* bool durable_data_removed = 3; */
        if (message.durableDataRemoved !== false)
            writer.tag(3, WireType.Varint).bool(message.durableDataRemoved);
        /* nimi.runtime.v1.AppInstallStorageProjection storage = 4; */
        if (message.storage)
            AppInstallStorageProjection.internalBinaryWrite(message.storage, writer.tag(4, WireType.LengthDelimited).fork(), options).join();
        /* nimi.runtime.v1.ReasonCode reason_code = 5; */
        if (message.reasonCode !== 0)
            writer.tag(5, WireType.Varint).int32(message.reasonCode);
        let u = options.writeUnknownFields;
        if (u !== false)
            (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
        return writer;
    }
}
/**
 * @generated MessageType for protobuf message nimi.runtime.v1.AppUninstallResult
 */
export const AppUninstallResult = new AppUninstallResult$Type();
// @generated message type with reflection information, may provide speed optimized methods
class UninstallAppResponse$Type extends MessageType {
    constructor() {
        super("nimi.runtime.v1.UninstallAppResponse", [
            { no: 1, name: "result", kind: "message", T: () => AppUninstallResult },
            { no: 2, name: "job", kind: "message", T: () => AppInstallJob }
        ]);
    }
    create(value) {
        const message = globalThis.Object.create((this.messagePrototype));
        if (value !== undefined)
            reflectionMergePartial(this, message, value);
        return message;
    }
    internalBinaryRead(reader, length, options, target) {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* nimi.runtime.v1.AppUninstallResult result */ 1:
                    message.result = AppUninstallResult.internalBinaryRead(reader, reader.uint32(), options, message.result);
                    break;
                case /* nimi.runtime.v1.AppInstallJob job */ 2:
                    message.job = AppInstallJob.internalBinaryRead(reader, reader.uint32(), options, message.job);
                    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, writer, options) {
        /* nimi.runtime.v1.AppUninstallResult result = 1; */
        if (message.result)
            AppUninstallResult.internalBinaryWrite(message.result, writer.tag(1, WireType.LengthDelimited).fork(), options).join();
        /* nimi.runtime.v1.AppInstallJob job = 2; */
        if (message.job)
            AppInstallJob.internalBinaryWrite(message.job, writer.tag(2, 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 nimi.runtime.v1.UninstallAppResponse
 */
export const UninstallAppResponse = new UninstallAppResponse$Type();
// @generated message type with reflection information, may provide speed optimized methods
class UpdateAppRequest$Type extends MessageType {
    constructor() {
        super("nimi.runtime.v1.UpdateAppRequest", [
            { no: 1, name: "app_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 2, name: "confirmed", kind: "scalar", T: 8 /*ScalarType.BOOL*/ }
        ]);
    }
    create(value) {
        const message = globalThis.Object.create((this.messagePrototype));
        message.appId = "";
        message.confirmed = false;
        if (value !== undefined)
            reflectionMergePartial(this, message, value);
        return message;
    }
    internalBinaryRead(reader, length, options, target) {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* string app_id */ 1:
                    message.appId = reader.string();
                    break;
                case /* bool confirmed */ 2:
                    message.confirmed = reader.bool();
                    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, writer, options) {
        /* string app_id = 1; */
        if (message.appId !== "")
            writer.tag(1, WireType.LengthDelimited).string(message.appId);
        /* bool confirmed = 2; */
        if (message.confirmed !== false)
            writer.tag(2, WireType.Varint).bool(message.confirmed);
        let u = options.writeUnknownFields;
        if (u !== false)
            (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
        return writer;
    }
}
/**
 * @generated MessageType for protobuf message nimi.runtime.v1.UpdateAppRequest
 */
export const UpdateAppRequest = new UpdateAppRequest$Type();
// @generated message type with reflection information, may provide speed optimized methods
class UpdateAppResponse$Type extends MessageType {
    constructor() {
        super("nimi.runtime.v1.UpdateAppResponse", [
            { no: 1, name: "job", kind: "message", T: () => AppInstallJob }
        ]);
    }
    create(value) {
        const message = globalThis.Object.create((this.messagePrototype));
        if (value !== undefined)
            reflectionMergePartial(this, message, value);
        return message;
    }
    internalBinaryRead(reader, length, options, target) {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* nimi.runtime.v1.AppInstallJob job */ 1:
                    message.job = AppInstallJob.internalBinaryRead(reader, reader.uint32(), options, message.job);
                    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, writer, options) {
        /* nimi.runtime.v1.AppInstallJob job = 1; */
        if (message.job)
            AppInstallJob.internalBinaryWrite(message.job, 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 nimi.runtime.v1.UpdateAppResponse
 */
export const UpdateAppResponse = new UpdateAppResponse$Type();
// @generated message type with reflection information, may provide speed optimized methods
class HealthRepairAppRequest$Type extends MessageType {
    constructor() {
        super("nimi.runtime.v1.HealthRepairAppRequest", [
            { no: 1, name: "app_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 2, name: "action", kind: "enum", T: () => ["nimi.runtime.v1.AppHealthRepairAction", AppHealthRepairAction, "APP_HEALTH_REPAIR_ACTION_"] },
            { no: 3, name: "job_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ }
        ]);
    }
    create(value) {
        const message = globalThis.Object.create((this.messagePrototype));
        message.appId = "";
        message.action = 0;
        message.jobId = "";
        if (value !== undefined)
            reflectionMergePartial(this, message, value);
        return message;
    }
    internalBinaryRead(reader, length, options, target) {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* string app_id */ 1:
                    message.appId = reader.string();
                    break;
                case /* nimi.runtime.v1.AppHealthRepairAction action */ 2:
                    message.action = reader.int32();
                    break;
                case /* string job_id */ 3:
                    message.jobId = 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, writer, options) {
        /* string app_id = 1; */
        if (message.appId !== "")
            writer.tag(1, WireType.LengthDelimited).string(message.appId);
        /* nimi.runtime.v1.AppHealthRepairAction action = 2; */
        if (message.action !== 0)
            writer.tag(2, WireType.Varint).int32(message.action);
        /* string job_id = 3; */
        if (message.jobId !== "")
            writer.tag(3, WireType.LengthDelimited).string(message.jobId);
        let u = options.writeUnknownFields;
        if (u !== false)
            (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
        return writer;
    }
}
/**
 * @generated MessageType for protobuf message nimi.runtime.v1.HealthRepairAppRequest
 */
export const HealthRepairAppRequest = new HealthRepairAppRequest$Type();
// @generated message type with reflection information, may provide speed optimized methods
class HealthRepairAppResponse$Type extends MessageType {
    constructor() {
        super("nimi.runtime.v1.HealthRepairAppResponse", [
            { no: 1, name: "job", kind: "message", T: () => AppInstallJob }
        ]);
    }
    create(value) {
        const message = globalThis.Object.create((this.messagePrototype));
        if (value !== undefined)
            reflectionMergePartial(this, message, value);
        return message;
    }
    internalBinaryRead(reader, length, options, target) {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* nimi.runtime.v1.AppInstallJob job */ 1:
                    message.job = AppInstallJob.internalBinaryRead(reader, reader.uint32(), options, message.job);
                    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, writer, options) {
        /* nimi.runtime.v1.AppInstallJob job = 1; */
        if (message.job)
            AppInstallJob.internalBinaryWrite(message.job, 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 nimi.runtime.v1.HealthRepairAppResponse
 */
export const HealthRepairAppResponse = new HealthRepairAppResponse$Type();
// @generated message type with reflection information, may provide speed optimized methods
class AppOpenScopeRef$Type extends MessageType {
    constructor() {
        super("nimi.runtime.v1.AppOpenScopeRef", [
            { no: 1, name: "kind", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 2, name: "owner_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 3, name: "surface_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ }
        ]);
    }
    create(value) {
        const message = globalThis.Object.create((this.messagePrototype));
        message.kind = "";
        message.ownerId = "";
        message.surfaceId = "";
        if (value !== undefined)
            reflectionMergePartial(this, message, value);
        return message;
    }
    internalBinaryRead(reader, length, options, target) {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* string kind */ 1:
                    message.kind = reader.string();
                    break;
                case /* string owner_id */ 2:
                    message.ownerId = reader.string();
                    break;
                case /* string surface_id */ 3:
                    message.surfaceId = 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, writer, options) {
        /* string kind = 1; */
        if (message.kind !== "")
            writer.tag(1, WireType.LengthDelimited).string(message.kind);
        /* string owner_id = 2; */
        if (message.ownerId !== "")
            writer.tag(2, WireType.LengthDelimited).string(message.ownerId);
        /* string surface_id = 3; */
        if (message.surfaceId !== "")
            writer.tag(3, WireType.LengthDelimited).string(message.surfaceId);
        let u = options.writeUnknownFields;
        if (u !== false)
            (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
        return writer;
    }
}
/**
 * @generated MessageType for protobuf message nimi.runtime.v1.AppOpenScopeRef
 */
export const AppOpenScopeRef = new AppOpenScopeRef$Type();
// @generated message type with reflection information, may provide speed optimized methods
class OpenAppRequest$Type extends MessageType {
    constructor() {
        super("nimi.runtime.v1.OpenAppRequest", [
            { no: 1, name: "app_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 2, name: "scope", kind: "message", T: () => AppOpenScopeRef }
        ]);
    }
    create(value) {
        const message = globalThis.Object.create((this.messagePrototype));
        message.appId = "";
        if (value !== undefined)
            reflectionMergePartial(this, message, value);
        return message;
    }
    internalBinaryRead(reader, length, options, target) {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* string app_id */ 1:
                    message.appId = reader.string();
                    break;
                case /* nimi.runtime.v1.AppOpenScopeRef scope */ 2:
                    message.scope = AppOpenScopeRef.internalBinaryRead(reader, reader.uint32(), options, message.scope);
                    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, writer, options) {
        /* string app_id = 1; */
        if (message.appId !== "")
            writer.tag(1, WireType.LengthDelimited).string(message.appId);
        /* nimi.runtime.v1.AppOpenScopeRef scope = 2; */
        if (message.scope)
            AppOpenScopeRef.internalBinaryWrite(message.scope, writer.tag(2, 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 nimi.runtime.v1.OpenAppRequest
 */
export const OpenAppRequest = new OpenAppRequest$Type();
// @generated message type with reflection information, may provide speed optimized methods
class AppOpenProjection$Type extends MessageType {
    constructor() {
        super("nimi.runtime.v1.AppOpenProjection", [
            { no: 1, name: "app_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 2, name: "state", kind: "enum", T: () => ["nimi.runtime.v1.AppOpenState", AppOpenState, "APP_OPEN_STATE_"] },
            { no: 3, name: "reached_step", kind: "enum", T: () => ["nimi.runtime.v1.AppOpenFlowStep", AppOpenFlowStep, "APP_OPEN_FLOW_STEP_"] },
            { no: 4, name: "launched", kind: "scalar", T: 8 /*ScalarType.BOOL*/ },
            { no: 5, name: "active_version", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 6, name: "scope", kind: "message", T: () => AppOpenScopeRef },
            { no: 7, name: "reason_code", kind: "enum", T: () => ["nimi.runtime.v1.ReasonCode", ReasonCode] },
            { no: 8, name: "detail", kind: "scalar", T: 9 /*ScalarType.STRING*/ }
        ]);
    }
    create(value) {
        const message = globalThis.Object.create((this.messagePrototype));
        message.appId = "";
        message.state = 0;
        message.reachedStep = 0;
        message.launched = false;
        message.activeVersion = "";
        message.reasonCode = 0;
        message.detail = "";
        if (value !== undefined)
            reflectionMergePartial(this, message, value);
        return message;
    }
    internalBinaryRead(reader, length, options, target) {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* string app_id */ 1:
                    message.appId = reader.string();
                    break;
                case /* nimi.runtime.v1.AppOpenState state */ 2:
                    message.state = reader.int32();
                    break;
                case /* nimi.runtime.v1.AppOpenFlowStep reached_step */ 3:
                    message.reachedStep = reader.int32();
                    break;
                case /* bool launched */ 4:
                    message.launched = reader.bool();
                    break;
                case /* string active_version */ 5:
                    message.activeVersion = reader.string();
                    break;
                case /* nimi.runtime.v1.AppOpenScopeRef scope */ 6:
                    message.scope = AppOpenScopeRef.internalBinaryRead(reader, reader.uint32(), options, message.scope);
                    break;
                case /* nimi.runtime.v1.ReasonCode reason_code */ 7:
                    message.reasonCode = reader.int32();
                    break;
                case /* string detail */ 8:
                    message.detail = 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, writer, options) {
        /* string app_id = 1; */
        if (message.appId !== "")
            writer.tag(1, WireType.LengthDelimited).string(message.appId);
        /* nimi.runtime.v1.AppOpenState state = 2; */
        if (message.state !== 0)
            writer.tag(2, WireType.Varint).int32(message.state);
        /* nimi.runtime.v1.AppOpenFlowStep reached_step = 3; */
        if (message.reachedStep !== 0)
            writer.tag(3, WireType.Varint).int32(message.reachedStep);
        /* bool launched = 4; */
        if (message.launched !== false)
            writer.tag(4, WireType.Varint).bool(message.launched);
        /* string active_version = 5; */
        if (message.activeVersion !== "")
            writer.tag(5, WireType.LengthDelimited).string(message.activeVersion);
        /* nimi.runtime.v1.AppOpenScopeRef scope = 6; */
        if (message.scope)
            AppOpenScopeRef.internalBinaryWrite(message.scope, writer.tag(6, WireType.LengthDelimited).fork(), options).join();
        /* nimi.runtime.v1.ReasonCode reason_code = 7; */
        if (message.reasonCode !== 0)
            writer.tag(7, WireType.Varint).int32(message.reasonCode);
        /* string detail = 8; */
        if (message.detail !== "")
            writer.tag(8, WireType.LengthDelimited).string(message.detail);
        let u = options.writeUnknownFields;
        if (u !== false)
            (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
        return writer;
    }
}
/**
 * @generated MessageType for protobuf message nimi.runtime.v1.AppOpenProjection
 */
export const AppOpenProjection = new AppOpenProjection$Type();
// @generated message type with reflection information, may provide speed optimized methods
class OpenAppResponse$Type extends MessageType {
    constructor() {
        super("nimi.runtime.v1.OpenAppResponse", [
            { no: 1, name: "projection", kind: "message", T: () => AppOpenProjection }
        ]);
    }
    create(value) {
        const message = globalThis.Object.create((this.messagePrototype));
        if (value !== undefined)
            reflectionMergePartial(this, message, value);
        return message;
    }
    internalBinaryRead(reader, length, options, target) {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* nimi.runtime.v1.AppOpenProjection projection */ 1:
                    message.projection = AppOpenProjection.internalBinaryRead(reader, reader.uint32(), options, message.projection);
                    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, writer, options) {
        /* nimi.runtime.v1.AppOpenProjection projection = 1; */
        if (message.projection)
            AppOpenProjection.internalBinaryWrite(message.projection, 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 nimi.runtime.v1.OpenAppResponse
 */
export const OpenAppResponse = new OpenAppResponse$Type();
/**
 * @generated ServiceType for protobuf service nimi.runtime.v1.RuntimeAppService
 */
export const RuntimeAppService = new ServiceType("nimi.runtime.v1.RuntimeAppService", [
    { name: "SendAppMessage", options: {}, I: SendAppMessageRequest, O: SendAppMessageResponse },
    { name: "SubscribeAppMessages", serverStreaming: true, options: {}, I: SubscribeAppMessagesRequest, O: AppMessageEvent },
    { name: "InstallApp", options: {}, I: InstallAppRequest, O: InstallAppResponse },
    { name: "UninstallApp", options: {}, I: UninstallAppRequest, O: UninstallAppResponse },
    { name: "GetAppInstallJob", options: {}, I: GetAppInstallJobRequest, O: GetAppInstallJobResponse },
    { name: "ListAppInstallJobs", options: {}, I: ListAppInstallJobsRequest, O: ListAppInstallJobsResponse },
    { name: "WatchAppInstallJobEvents", serverStreaming: true, options: {}, I: WatchAppInstallJobEventsRequest, O: AppInstallJobEvent },
    { name: "UpdateApp", options: {}, I: UpdateAppRequest, O: UpdateAppResponse },
    { name: "HealthRepairApp", options: {}, I: HealthRepairAppRequest, O: HealthRepairAppResponse },
    { name: "OpenApp", options: {}, I: OpenAppRequest, O: OpenAppResponse }
]);
//# sourceMappingURL=app.js.map