/* eslint-disable */
// @generated by protobuf-ts 2.11.1 with parameter output_javascript,optimize_code_size,long_type_string,add_pb_suffix,ts_nocheck,eslint_disable
// @generated from protobuf file "runme/stream/v1/websockets.proto" (package "runme.stream.v1", syntax proto3)
// tslint:disable
// @ts-nocheck
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 { ExecuteResponse } from "../../runner/v2/runner_pb";
import { ExecuteRequest } from "../../runner/v2/runner_pb";
import { Code } from "../../../google/rpc/code_pb";
// @generated message type with reflection information, may provide speed optimized methods
class WebsocketStatus$Type extends MessageType {
    constructor() {
        super("runme.stream.v1.WebsocketStatus", [
            { no: 1, name: "code", kind: "enum", T: () => ["google.rpc.Code", Code] },
            { no: 2, name: "message", kind: "scalar", T: 9 /*ScalarType.STRING*/ }
        ]);
    }
    create(value) {
        const message = globalThis.Object.create((this.messagePrototype));
        message.code = 0;
        message.message = "";
        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 /* google.rpc.Code code */ 1:
                    message.code = reader.int32();
                    break;
                case /* string message */ 2:
                    message.message = 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) {
        /* google.rpc.Code code = 1; */
        if (message.code !== 0)
            writer.tag(1, WireType.Varint).int32(message.code);
        /* string message = 2; */
        if (message.message !== "")
            writer.tag(2, WireType.LengthDelimited).string(message.message);
        let u = options.writeUnknownFields;
        if (u !== false)
            (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
        return writer;
    }
}
/**
 * @generated MessageType for protobuf message runme.stream.v1.WebsocketStatus
 */
export const WebsocketStatus = new WebsocketStatus$Type();
// @generated message type with reflection information, may provide speed optimized methods
class Ping$Type extends MessageType {
    constructor() {
        super("runme.stream.v1.Ping", [
            { no: 1, name: "timestamp", kind: "scalar", T: 3 /*ScalarType.INT64*/ }
        ]);
    }
    create(value) {
        const message = globalThis.Object.create((this.messagePrototype));
        message.timestamp = "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 /* int64 timestamp */ 1:
                    message.timestamp = reader.int64().toString();
                    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) {
        /* int64 timestamp = 1; */
        if (message.timestamp !== "0")
            writer.tag(1, WireType.Varint).int64(message.timestamp);
        let u = options.writeUnknownFields;
        if (u !== false)
            (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
        return writer;
    }
}
/**
 * @generated MessageType for protobuf message runme.stream.v1.Ping
 */
export const Ping = new Ping$Type();
// @generated message type with reflection information, may provide speed optimized methods
class Pong$Type extends MessageType {
    constructor() {
        super("runme.stream.v1.Pong", [
            { no: 1, name: "timestamp", kind: "scalar", T: 3 /*ScalarType.INT64*/ }
        ]);
    }
    create(value) {
        const message = globalThis.Object.create((this.messagePrototype));
        message.timestamp = "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 /* int64 timestamp */ 1:
                    message.timestamp = reader.int64().toString();
                    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) {
        /* int64 timestamp = 1; */
        if (message.timestamp !== "0")
            writer.tag(1, WireType.Varint).int64(message.timestamp);
        let u = options.writeUnknownFields;
        if (u !== false)
            (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
        return writer;
    }
}
/**
 * @generated MessageType for protobuf message runme.stream.v1.Pong
 */
export const Pong = new Pong$Type();
// @generated message type with reflection information, may provide speed optimized methods
class WebsocketRequest$Type extends MessageType {
    constructor() {
        super("runme.stream.v1.WebsocketRequest", [
            { no: 1, name: "execute_request", kind: "message", oneof: "payload", T: () => ExecuteRequest },
            { no: 100, name: "ping", kind: "message", T: () => Ping },
            { no: 200, name: "authorization", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 210, name: "known_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 220, name: "run_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ }
        ]);
    }
    create(value) {
        const message = globalThis.Object.create((this.messagePrototype));
        message.payload = { oneofKind: undefined };
        message.authorization = "";
        message.knownId = "";
        message.runId = "";
        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 /* runme.runner.v2.ExecuteRequest execute_request */ 1:
                    message.payload = {
                        oneofKind: "executeRequest",
                        executeRequest: ExecuteRequest.internalBinaryRead(reader, reader.uint32(), options, message.payload.executeRequest)
                    };
                    break;
                case /* runme.stream.v1.Ping ping */ 100:
                    message.ping = Ping.internalBinaryRead(reader, reader.uint32(), options, message.ping);
                    break;
                case /* string authorization */ 200:
                    message.authorization = reader.string();
                    break;
                case /* string known_id */ 210:
                    message.knownId = reader.string();
                    break;
                case /* string run_id */ 220:
                    message.runId = 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) {
        /* runme.runner.v2.ExecuteRequest execute_request = 1; */
        if (message.payload.oneofKind === "executeRequest")
            ExecuteRequest.internalBinaryWrite(message.payload.executeRequest, writer.tag(1, WireType.LengthDelimited).fork(), options).join();
        /* runme.stream.v1.Ping ping = 100; */
        if (message.ping)
            Ping.internalBinaryWrite(message.ping, writer.tag(100, WireType.LengthDelimited).fork(), options).join();
        /* string authorization = 200; */
        if (message.authorization !== "")
            writer.tag(200, WireType.LengthDelimited).string(message.authorization);
        /* string known_id = 210; */
        if (message.knownId !== "")
            writer.tag(210, WireType.LengthDelimited).string(message.knownId);
        /* string run_id = 220; */
        if (message.runId !== "")
            writer.tag(220, WireType.LengthDelimited).string(message.runId);
        let u = options.writeUnknownFields;
        if (u !== false)
            (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
        return writer;
    }
}
/**
 * @generated MessageType for protobuf message runme.stream.v1.WebsocketRequest
 */
export const WebsocketRequest = new WebsocketRequest$Type();
// @generated message type with reflection information, may provide speed optimized methods
class WebsocketResponse$Type extends MessageType {
    constructor() {
        super("runme.stream.v1.WebsocketResponse", [
            { no: 1, name: "execute_response", kind: "message", oneof: "payload", T: () => ExecuteResponse },
            { no: 100, name: "pong", kind: "message", T: () => Pong },
            { no: 200, name: "status", kind: "message", T: () => WebsocketStatus },
            { no: 210, name: "known_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 220, name: "run_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ }
        ]);
    }
    create(value) {
        const message = globalThis.Object.create((this.messagePrototype));
        message.payload = { oneofKind: undefined };
        message.knownId = "";
        message.runId = "";
        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 /* runme.runner.v2.ExecuteResponse execute_response */ 1:
                    message.payload = {
                        oneofKind: "executeResponse",
                        executeResponse: ExecuteResponse.internalBinaryRead(reader, reader.uint32(), options, message.payload.executeResponse)
                    };
                    break;
                case /* runme.stream.v1.Pong pong */ 100:
                    message.pong = Pong.internalBinaryRead(reader, reader.uint32(), options, message.pong);
                    break;
                case /* runme.stream.v1.WebsocketStatus status */ 200:
                    message.status = WebsocketStatus.internalBinaryRead(reader, reader.uint32(), options, message.status);
                    break;
                case /* string known_id */ 210:
                    message.knownId = reader.string();
                    break;
                case /* string run_id */ 220:
                    message.runId = 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) {
        /* runme.runner.v2.ExecuteResponse execute_response = 1; */
        if (message.payload.oneofKind === "executeResponse")
            ExecuteResponse.internalBinaryWrite(message.payload.executeResponse, writer.tag(1, WireType.LengthDelimited).fork(), options).join();
        /* runme.stream.v1.Pong pong = 100; */
        if (message.pong)
            Pong.internalBinaryWrite(message.pong, writer.tag(100, WireType.LengthDelimited).fork(), options).join();
        /* runme.stream.v1.WebsocketStatus status = 200; */
        if (message.status)
            WebsocketStatus.internalBinaryWrite(message.status, writer.tag(200, WireType.LengthDelimited).fork(), options).join();
        /* string known_id = 210; */
        if (message.knownId !== "")
            writer.tag(210, WireType.LengthDelimited).string(message.knownId);
        /* string run_id = 220; */
        if (message.runId !== "")
            writer.tag(220, WireType.LengthDelimited).string(message.runId);
        let u = options.writeUnknownFields;
        if (u !== false)
            (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
        return writer;
    }
}
/**
 * @generated MessageType for protobuf message runme.stream.v1.WebsocketResponse
 */
export const WebsocketResponse = new WebsocketResponse$Type();
