/* 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/runner/v2/config.proto" (package "runme.runner.v2", 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";
/**
 * @generated from protobuf enum runme.runner.v2.CommandMode
 */
export var CommandMode;
(function (CommandMode) {
    /**
     * @generated from protobuf enum value: COMMAND_MODE_UNSPECIFIED = 0;
     */
    CommandMode[CommandMode["UNSPECIFIED"] = 0] = "UNSPECIFIED";
    /**
     * COMMAND_MODE_INLINE indicates that the command should be executed inline.
     * For example: bash -c "echo 'Hello, World'"
     *
     * @generated from protobuf enum value: COMMAND_MODE_INLINE = 1;
     */
    CommandMode[CommandMode["INLINE"] = 1] = "INLINE";
    /**
     * COMMAND_MODE_FILE indicates that the command should be executed as a file.
     * For example: bash /tmp/script.sh
     *
     * @generated from protobuf enum value: COMMAND_MODE_FILE = 2;
     */
    CommandMode[CommandMode["FILE"] = 2] = "FILE";
    /**
     * COMMAND_MODE_TERMINAL indicates that the command should be executed as a Runme Terminal.
     * This is used by the VS Code extension.
     *
     * @generated from protobuf enum value: COMMAND_MODE_TERMINAL = 3;
     */
    CommandMode[CommandMode["TERMINAL"] = 3] = "TERMINAL";
    /**
     * COMMAND_MODE_CLI indicates that the command is executed via runme CLI.
     * It is executed as a native command.
     *
     * @generated from protobuf enum value: COMMAND_MODE_CLI = 4;
     */
    CommandMode[CommandMode["CLI"] = 4] = "CLI";
})(CommandMode || (CommandMode = {}));
// @generated message type with reflection information, may provide speed optimized methods
class ProgramConfig$Type extends MessageType {
    constructor() {
        super("runme.runner.v2.ProgramConfig", [
            { no: 1, name: "program_name", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 2, name: "arguments", kind: "scalar", repeat: 2 /*RepeatType.UNPACKED*/, T: 9 /*ScalarType.STRING*/ },
            { no: 3, name: "directory", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 4, name: "language_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 5, name: "background", kind: "scalar", T: 8 /*ScalarType.BOOL*/ },
            { no: 6, name: "file_extension", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 7, name: "env", kind: "scalar", repeat: 2 /*RepeatType.UNPACKED*/, T: 9 /*ScalarType.STRING*/ },
            { no: 8, name: "commands", kind: "message", oneof: "source", T: () => ProgramConfig_CommandList },
            { no: 9, name: "script", kind: "scalar", oneof: "source", T: 9 /*ScalarType.STRING*/ },
            { no: 10, name: "interactive", kind: "scalar", T: 8 /*ScalarType.BOOL*/ },
            { no: 11, name: "mode", kind: "enum", T: () => ["runme.runner.v2.CommandMode", CommandMode, "COMMAND_MODE_"] },
            { no: 12, name: "known_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 13, name: "known_name", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 14, name: "run_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ }
        ]);
    }
    create(value) {
        const message = globalThis.Object.create((this.messagePrototype));
        message.programName = "";
        message.arguments = [];
        message.directory = "";
        message.languageId = "";
        message.background = false;
        message.fileExtension = "";
        message.env = [];
        message.source = { oneofKind: undefined };
        message.interactive = false;
        message.mode = 0;
        message.knownId = "";
        message.knownName = "";
        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 /* string program_name */ 1:
                    message.programName = reader.string();
                    break;
                case /* repeated string arguments */ 2:
                    message.arguments.push(reader.string());
                    break;
                case /* string directory */ 3:
                    message.directory = reader.string();
                    break;
                case /* string language_id */ 4:
                    message.languageId = reader.string();
                    break;
                case /* bool background */ 5:
                    message.background = reader.bool();
                    break;
                case /* string file_extension */ 6:
                    message.fileExtension = reader.string();
                    break;
                case /* repeated string env */ 7:
                    message.env.push(reader.string());
                    break;
                case /* runme.runner.v2.ProgramConfig.CommandList commands */ 8:
                    message.source = {
                        oneofKind: "commands",
                        commands: ProgramConfig_CommandList.internalBinaryRead(reader, reader.uint32(), options, message.source.commands)
                    };
                    break;
                case /* string script */ 9:
                    message.source = {
                        oneofKind: "script",
                        script: reader.string()
                    };
                    break;
                case /* bool interactive */ 10:
                    message.interactive = reader.bool();
                    break;
                case /* runme.runner.v2.CommandMode mode */ 11:
                    message.mode = reader.int32();
                    break;
                case /* string known_id */ 12:
                    message.knownId = reader.string();
                    break;
                case /* string known_name */ 13:
                    message.knownName = reader.string();
                    break;
                case /* string run_id */ 14:
                    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) {
        /* string program_name = 1; */
        if (message.programName !== "")
            writer.tag(1, WireType.LengthDelimited).string(message.programName);
        /* repeated string arguments = 2; */
        for (let i = 0; i < message.arguments.length; i++)
            writer.tag(2, WireType.LengthDelimited).string(message.arguments[i]);
        /* string directory = 3; */
        if (message.directory !== "")
            writer.tag(3, WireType.LengthDelimited).string(message.directory);
        /* string language_id = 4; */
        if (message.languageId !== "")
            writer.tag(4, WireType.LengthDelimited).string(message.languageId);
        /* bool background = 5; */
        if (message.background !== false)
            writer.tag(5, WireType.Varint).bool(message.background);
        /* string file_extension = 6; */
        if (message.fileExtension !== "")
            writer.tag(6, WireType.LengthDelimited).string(message.fileExtension);
        /* repeated string env = 7; */
        for (let i = 0; i < message.env.length; i++)
            writer.tag(7, WireType.LengthDelimited).string(message.env[i]);
        /* runme.runner.v2.ProgramConfig.CommandList commands = 8; */
        if (message.source.oneofKind === "commands")
            ProgramConfig_CommandList.internalBinaryWrite(message.source.commands, writer.tag(8, WireType.LengthDelimited).fork(), options).join();
        /* string script = 9; */
        if (message.source.oneofKind === "script")
            writer.tag(9, WireType.LengthDelimited).string(message.source.script);
        /* bool interactive = 10; */
        if (message.interactive !== false)
            writer.tag(10, WireType.Varint).bool(message.interactive);
        /* runme.runner.v2.CommandMode mode = 11; */
        if (message.mode !== 0)
            writer.tag(11, WireType.Varint).int32(message.mode);
        /* string known_id = 12; */
        if (message.knownId !== "")
            writer.tag(12, WireType.LengthDelimited).string(message.knownId);
        /* string known_name = 13; */
        if (message.knownName !== "")
            writer.tag(13, WireType.LengthDelimited).string(message.knownName);
        /* string run_id = 14; */
        if (message.runId !== "")
            writer.tag(14, 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.runner.v2.ProgramConfig
 */
export const ProgramConfig = new ProgramConfig$Type();
// @generated message type with reflection information, may provide speed optimized methods
class ProgramConfig_CommandList$Type extends MessageType {
    constructor() {
        super("runme.runner.v2.ProgramConfig.CommandList", [
            { no: 1, name: "items", kind: "scalar", repeat: 2 /*RepeatType.UNPACKED*/, T: 9 /*ScalarType.STRING*/ }
        ]);
    }
    create(value) {
        const message = globalThis.Object.create((this.messagePrototype));
        message.items = [];
        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 string items */ 1:
                    message.items.push(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) {
        /* repeated string items = 1; */
        for (let i = 0; i < message.items.length; i++)
            writer.tag(1, WireType.LengthDelimited).string(message.items[i]);
        let u = options.writeUnknownFields;
        if (u !== false)
            (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
        return writer;
    }
}
/**
 * @generated MessageType for protobuf message runme.runner.v2.ProgramConfig.CommandList
 */
export const ProgramConfig_CommandList = new ProgramConfig_CommandList$Type();
