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 { ScopedRuntimeBindingAttachment } from "./common.js";
// @generated message type with reflection information, may provide speed optimized methods
class AgentRequestContext$Type extends MessageType {
    constructor() {
        super("nimi.runtime.v1.AgentRequestContext", [
            { 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: "scoped_binding", kind: "message", T: () => ScopedRuntimeBindingAttachment },
            { no: 4, name: "owner_user_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 5, name: "realm_agent_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 6, name: "local_agent_ref", kind: "scalar", T: 9 /*ScalarType.STRING*/ }
        ]);
    }
    create(value) {
        const message = globalThis.Object.create((this.messagePrototype));
        message.appId = "";
        message.subjectUserId = "";
        message.ownerUserId = "";
        message.realmAgentId = "";
        message.localAgentRef = "";
        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 /* nimi.runtime.v1.ScopedRuntimeBindingAttachment scoped_binding */ 3:
                    message.scopedBinding = ScopedRuntimeBindingAttachment.internalBinaryRead(reader, reader.uint32(), options, message.scopedBinding);
                    break;
                case /* string owner_user_id */ 4:
                    message.ownerUserId = reader.string();
                    break;
                case /* string realm_agent_id */ 5:
                    message.realmAgentId = reader.string();
                    break;
                case /* string local_agent_ref */ 6:
                    message.localAgentRef = 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);
        /* string subject_user_id = 2; */
        if (message.subjectUserId !== "")
            writer.tag(2, WireType.LengthDelimited).string(message.subjectUserId);
        /* nimi.runtime.v1.ScopedRuntimeBindingAttachment scoped_binding = 3; */
        if (message.scopedBinding)
            ScopedRuntimeBindingAttachment.internalBinaryWrite(message.scopedBinding, writer.tag(3, WireType.LengthDelimited).fork(), options).join();
        /* string owner_user_id = 4; */
        if (message.ownerUserId !== "")
            writer.tag(4, WireType.LengthDelimited).string(message.ownerUserId);
        /* string realm_agent_id = 5; */
        if (message.realmAgentId !== "")
            writer.tag(5, WireType.LengthDelimited).string(message.realmAgentId);
        /* string local_agent_ref = 6; */
        if (message.localAgentRef !== "")
            writer.tag(6, WireType.LengthDelimited).string(message.localAgentRef);
        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.AgentRequestContext
 */
export const AgentRequestContext = new AgentRequestContext$Type();
//# sourceMappingURL=agent_common.js.map