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 { AgentRequestContext } from "./agent_common.js";
/**
 * @generated from protobuf enum nimi.runtime.v1.RealmGroupMessageCandidateCommitDisposition
 */
export var RealmGroupMessageCandidateCommitDisposition;
(function (RealmGroupMessageCandidateCommitDisposition) {
    /**
     * @generated from protobuf enum value: REALM_GROUP_MESSAGE_CANDIDATE_COMMIT_DISPOSITION_UNSPECIFIED = 0;
     */
    RealmGroupMessageCandidateCommitDisposition[RealmGroupMessageCandidateCommitDisposition["UNSPECIFIED"] = 0] = "UNSPECIFIED";
    /**
     * @generated from protobuf enum value: REALM_GROUP_MESSAGE_CANDIDATE_COMMIT_DISPOSITION_MESSAGE_CANDIDATE = 1;
     */
    RealmGroupMessageCandidateCommitDisposition[RealmGroupMessageCandidateCommitDisposition["MESSAGE_CANDIDATE"] = 1] = "MESSAGE_CANDIDATE";
    /**
     * @generated from protobuf enum value: REALM_GROUP_MESSAGE_CANDIDATE_COMMIT_DISPOSITION_REFUSAL_CANDIDATE = 2;
     */
    RealmGroupMessageCandidateCommitDisposition[RealmGroupMessageCandidateCommitDisposition["REFUSAL_CANDIDATE"] = 2] = "REFUSAL_CANDIDATE";
})(RealmGroupMessageCandidateCommitDisposition || (RealmGroupMessageCandidateCommitDisposition = {}));
// @generated message type with reflection information, may provide speed optimized methods
class CreateRealmGroupMessageCandidateRequest$Type extends MessageType {
    constructor() {
        super("nimi.runtime.v1.CreateRealmGroupMessageCandidateRequest", [
            { no: 1, name: "context", kind: "message", T: () => AgentRequestContext },
            { no: 2, name: "realm_group_thread_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 3, name: "realm_group_agent_slot_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { 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*/ },
            { no: 7, name: "trigger_ref", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 8, name: "membership_snapshot_ref", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 9, name: "read_cursor_ref", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 10, name: "reply_target_ref", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 11, name: "room_orchestration_ref", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 12, name: "idempotency_key", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 13, name: "context_refs", kind: "map", K: 9 /*ScalarType.STRING*/, V: { kind: "scalar", T: 9 /*ScalarType.STRING*/ } }
        ]);
    }
    create(value) {
        const message = globalThis.Object.create((this.messagePrototype));
        message.realmGroupThreadId = "";
        message.realmGroupAgentSlotId = "";
        message.ownerUserId = "";
        message.realmAgentId = "";
        message.localAgentRef = "";
        message.triggerRef = "";
        message.membershipSnapshotRef = "";
        message.readCursorRef = "";
        message.replyTargetRef = "";
        message.roomOrchestrationRef = "";
        message.idempotencyKey = "";
        message.contextRefs = {};
        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.AgentRequestContext context */ 1:
                    message.context = AgentRequestContext.internalBinaryRead(reader, reader.uint32(), options, message.context);
                    break;
                case /* string realm_group_thread_id */ 2:
                    message.realmGroupThreadId = reader.string();
                    break;
                case /* string realm_group_agent_slot_id */ 3:
                    message.realmGroupAgentSlotId = reader.string();
                    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;
                case /* string trigger_ref */ 7:
                    message.triggerRef = reader.string();
                    break;
                case /* string membership_snapshot_ref */ 8:
                    message.membershipSnapshotRef = reader.string();
                    break;
                case /* string read_cursor_ref */ 9:
                    message.readCursorRef = reader.string();
                    break;
                case /* string reply_target_ref */ 10:
                    message.replyTargetRef = reader.string();
                    break;
                case /* string room_orchestration_ref */ 11:
                    message.roomOrchestrationRef = reader.string();
                    break;
                case /* string idempotency_key */ 12:
                    message.idempotencyKey = reader.string();
                    break;
                case /* map<string, string> context_refs */ 13:
                    this.binaryReadMap13(message.contextRefs, reader, 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;
    }
    binaryReadMap13(map, reader, options) {
        let len = reader.uint32(), end = reader.pos + len, key, val;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case 1:
                    key = reader.string();
                    break;
                case 2:
                    val = reader.string();
                    break;
                default: throw new globalThis.Error("unknown map entry field for nimi.runtime.v1.CreateRealmGroupMessageCandidateRequest.context_refs");
            }
        }
        map[key ?? ""] = val ?? "";
    }
    internalBinaryWrite(message, writer, options) {
        /* nimi.runtime.v1.AgentRequestContext context = 1; */
        if (message.context)
            AgentRequestContext.internalBinaryWrite(message.context, writer.tag(1, WireType.LengthDelimited).fork(), options).join();
        /* string realm_group_thread_id = 2; */
        if (message.realmGroupThreadId !== "")
            writer.tag(2, WireType.LengthDelimited).string(message.realmGroupThreadId);
        /* string realm_group_agent_slot_id = 3; */
        if (message.realmGroupAgentSlotId !== "")
            writer.tag(3, WireType.LengthDelimited).string(message.realmGroupAgentSlotId);
        /* 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);
        /* string trigger_ref = 7; */
        if (message.triggerRef !== "")
            writer.tag(7, WireType.LengthDelimited).string(message.triggerRef);
        /* string membership_snapshot_ref = 8; */
        if (message.membershipSnapshotRef !== "")
            writer.tag(8, WireType.LengthDelimited).string(message.membershipSnapshotRef);
        /* string read_cursor_ref = 9; */
        if (message.readCursorRef !== "")
            writer.tag(9, WireType.LengthDelimited).string(message.readCursorRef);
        /* string reply_target_ref = 10; */
        if (message.replyTargetRef !== "")
            writer.tag(10, WireType.LengthDelimited).string(message.replyTargetRef);
        /* string room_orchestration_ref = 11; */
        if (message.roomOrchestrationRef !== "")
            writer.tag(11, WireType.LengthDelimited).string(message.roomOrchestrationRef);
        /* string idempotency_key = 12; */
        if (message.idempotencyKey !== "")
            writer.tag(12, WireType.LengthDelimited).string(message.idempotencyKey);
        /* map<string, string> context_refs = 13; */
        for (let k of globalThis.Object.keys(message.contextRefs))
            writer.tag(13, WireType.LengthDelimited).fork().tag(1, WireType.LengthDelimited).string(k).tag(2, WireType.LengthDelimited).string(message.contextRefs[k]).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.CreateRealmGroupMessageCandidateRequest
 */
export const CreateRealmGroupMessageCandidateRequest = new CreateRealmGroupMessageCandidateRequest$Type();
// @generated message type with reflection information, may provide speed optimized methods
class RealmGroupMessageCandidateCommitHandle$Type extends MessageType {
    constructor() {
        super("nimi.runtime.v1.RealmGroupMessageCandidateCommitHandle", [
            { no: 1, name: "candidate_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 2, name: "candidate_kind", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 3, name: "candidate_evidence_ref", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 4, name: "evidence_hash", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 5, name: "runtime_trace_ref", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 6, name: "realm_group_thread_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 7, name: "realm_group_agent_slot_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 8, name: "owner_user_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 9, name: "realm_agent_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 10, name: "local_agent_ref", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 11, name: "trigger_ref", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 12, name: "output_candidate_ref", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 13, name: "audit_lineage_ref", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 14, name: "policy_verdict_ref", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 15, name: "created_at", kind: "message", T: () => Timestamp },
            { no: 16, name: "expires_at", kind: "message", T: () => Timestamp },
            { no: 17, name: "commit_disposition", kind: "enum", T: () => ["nimi.runtime.v1.RealmGroupMessageCandidateCommitDisposition", RealmGroupMessageCandidateCommitDisposition, "REALM_GROUP_MESSAGE_CANDIDATE_COMMIT_DISPOSITION_"] }
        ]);
    }
    create(value) {
        const message = globalThis.Object.create((this.messagePrototype));
        message.candidateId = "";
        message.candidateKind = "";
        message.candidateEvidenceRef = "";
        message.evidenceHash = "";
        message.runtimeTraceRef = "";
        message.realmGroupThreadId = "";
        message.realmGroupAgentSlotId = "";
        message.ownerUserId = "";
        message.realmAgentId = "";
        message.localAgentRef = "";
        message.triggerRef = "";
        message.outputCandidateRef = "";
        message.auditLineageRef = "";
        message.policyVerdictRef = "";
        message.commitDisposition = 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 candidate_id */ 1:
                    message.candidateId = reader.string();
                    break;
                case /* string candidate_kind */ 2:
                    message.candidateKind = reader.string();
                    break;
                case /* string candidate_evidence_ref */ 3:
                    message.candidateEvidenceRef = reader.string();
                    break;
                case /* string evidence_hash */ 4:
                    message.evidenceHash = reader.string();
                    break;
                case /* string runtime_trace_ref */ 5:
                    message.runtimeTraceRef = reader.string();
                    break;
                case /* string realm_group_thread_id */ 6:
                    message.realmGroupThreadId = reader.string();
                    break;
                case /* string realm_group_agent_slot_id */ 7:
                    message.realmGroupAgentSlotId = reader.string();
                    break;
                case /* string owner_user_id */ 8:
                    message.ownerUserId = reader.string();
                    break;
                case /* string realm_agent_id */ 9:
                    message.realmAgentId = reader.string();
                    break;
                case /* string local_agent_ref */ 10:
                    message.localAgentRef = reader.string();
                    break;
                case /* string trigger_ref */ 11:
                    message.triggerRef = reader.string();
                    break;
                case /* string output_candidate_ref */ 12:
                    message.outputCandidateRef = reader.string();
                    break;
                case /* string audit_lineage_ref */ 13:
                    message.auditLineageRef = reader.string();
                    break;
                case /* string policy_verdict_ref */ 14:
                    message.policyVerdictRef = reader.string();
                    break;
                case /* google.protobuf.Timestamp created_at */ 15:
                    message.createdAt = Timestamp.internalBinaryRead(reader, reader.uint32(), options, message.createdAt);
                    break;
                case /* google.protobuf.Timestamp expires_at */ 16:
                    message.expiresAt = Timestamp.internalBinaryRead(reader, reader.uint32(), options, message.expiresAt);
                    break;
                case /* nimi.runtime.v1.RealmGroupMessageCandidateCommitDisposition commit_disposition */ 17:
                    message.commitDisposition = 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 candidate_id = 1; */
        if (message.candidateId !== "")
            writer.tag(1, WireType.LengthDelimited).string(message.candidateId);
        /* string candidate_kind = 2; */
        if (message.candidateKind !== "")
            writer.tag(2, WireType.LengthDelimited).string(message.candidateKind);
        /* string candidate_evidence_ref = 3; */
        if (message.candidateEvidenceRef !== "")
            writer.tag(3, WireType.LengthDelimited).string(message.candidateEvidenceRef);
        /* string evidence_hash = 4; */
        if (message.evidenceHash !== "")
            writer.tag(4, WireType.LengthDelimited).string(message.evidenceHash);
        /* string runtime_trace_ref = 5; */
        if (message.runtimeTraceRef !== "")
            writer.tag(5, WireType.LengthDelimited).string(message.runtimeTraceRef);
        /* string realm_group_thread_id = 6; */
        if (message.realmGroupThreadId !== "")
            writer.tag(6, WireType.LengthDelimited).string(message.realmGroupThreadId);
        /* string realm_group_agent_slot_id = 7; */
        if (message.realmGroupAgentSlotId !== "")
            writer.tag(7, WireType.LengthDelimited).string(message.realmGroupAgentSlotId);
        /* string owner_user_id = 8; */
        if (message.ownerUserId !== "")
            writer.tag(8, WireType.LengthDelimited).string(message.ownerUserId);
        /* string realm_agent_id = 9; */
        if (message.realmAgentId !== "")
            writer.tag(9, WireType.LengthDelimited).string(message.realmAgentId);
        /* string local_agent_ref = 10; */
        if (message.localAgentRef !== "")
            writer.tag(10, WireType.LengthDelimited).string(message.localAgentRef);
        /* string trigger_ref = 11; */
        if (message.triggerRef !== "")
            writer.tag(11, WireType.LengthDelimited).string(message.triggerRef);
        /* string output_candidate_ref = 12; */
        if (message.outputCandidateRef !== "")
            writer.tag(12, WireType.LengthDelimited).string(message.outputCandidateRef);
        /* string audit_lineage_ref = 13; */
        if (message.auditLineageRef !== "")
            writer.tag(13, WireType.LengthDelimited).string(message.auditLineageRef);
        /* string policy_verdict_ref = 14; */
        if (message.policyVerdictRef !== "")
            writer.tag(14, WireType.LengthDelimited).string(message.policyVerdictRef);
        /* google.protobuf.Timestamp created_at = 15; */
        if (message.createdAt)
            Timestamp.internalBinaryWrite(message.createdAt, writer.tag(15, WireType.LengthDelimited).fork(), options).join();
        /* google.protobuf.Timestamp expires_at = 16; */
        if (message.expiresAt)
            Timestamp.internalBinaryWrite(message.expiresAt, writer.tag(16, WireType.LengthDelimited).fork(), options).join();
        /* nimi.runtime.v1.RealmGroupMessageCandidateCommitDisposition commit_disposition = 17; */
        if (message.commitDisposition !== 0)
            writer.tag(17, WireType.Varint).int32(message.commitDisposition);
        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.RealmGroupMessageCandidateCommitHandle
 */
export const RealmGroupMessageCandidateCommitHandle = new RealmGroupMessageCandidateCommitHandle$Type();
// @generated message type with reflection information, may provide speed optimized methods
class CreateRealmGroupMessageCandidateResponse$Type extends MessageType {
    constructor() {
        super("nimi.runtime.v1.CreateRealmGroupMessageCandidateResponse", [
            { no: 1, name: "candidate", kind: "message", T: () => RealmGroupMessageCandidateCommitHandle }
        ]);
    }
    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.RealmGroupMessageCandidateCommitHandle candidate */ 1:
                    message.candidate = RealmGroupMessageCandidateCommitHandle.internalBinaryRead(reader, reader.uint32(), options, message.candidate);
                    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.RealmGroupMessageCandidateCommitHandle candidate = 1; */
        if (message.candidate)
            RealmGroupMessageCandidateCommitHandle.internalBinaryWrite(message.candidate, 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.CreateRealmGroupMessageCandidateResponse
 */
export const CreateRealmGroupMessageCandidateResponse = new CreateRealmGroupMessageCandidateResponse$Type();
// @generated message type with reflection information, may provide speed optimized methods
class GetRealmGroupMessageCandidateEvidenceRequest$Type extends MessageType {
    constructor() {
        super("nimi.runtime.v1.GetRealmGroupMessageCandidateEvidenceRequest", [
            { no: 1, name: "context", kind: "message", T: () => AgentRequestContext },
            { no: 2, name: "candidate_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 3, name: "candidate_kind", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 4, name: "candidate_evidence_ref", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 5, name: "evidence_hash", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 6, name: "runtime_trace_ref", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 7, name: "expected_realm_group_agent_slot_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 8, name: "expected_local_agent_ref", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 9, name: "trigger_ref", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 10, name: "target_realm_group_thread_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ }
        ]);
    }
    create(value) {
        const message = globalThis.Object.create((this.messagePrototype));
        message.candidateId = "";
        message.candidateKind = "";
        message.candidateEvidenceRef = "";
        message.evidenceHash = "";
        message.runtimeTraceRef = "";
        message.expectedRealmGroupAgentSlotId = "";
        message.expectedLocalAgentRef = "";
        message.triggerRef = "";
        message.targetRealmGroupThreadId = "";
        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.AgentRequestContext context */ 1:
                    message.context = AgentRequestContext.internalBinaryRead(reader, reader.uint32(), options, message.context);
                    break;
                case /* string candidate_id */ 2:
                    message.candidateId = reader.string();
                    break;
                case /* string candidate_kind */ 3:
                    message.candidateKind = reader.string();
                    break;
                case /* string candidate_evidence_ref */ 4:
                    message.candidateEvidenceRef = reader.string();
                    break;
                case /* string evidence_hash */ 5:
                    message.evidenceHash = reader.string();
                    break;
                case /* string runtime_trace_ref */ 6:
                    message.runtimeTraceRef = reader.string();
                    break;
                case /* string expected_realm_group_agent_slot_id */ 7:
                    message.expectedRealmGroupAgentSlotId = reader.string();
                    break;
                case /* string expected_local_agent_ref */ 8:
                    message.expectedLocalAgentRef = reader.string();
                    break;
                case /* string trigger_ref */ 9:
                    message.triggerRef = reader.string();
                    break;
                case /* string target_realm_group_thread_id */ 10:
                    message.targetRealmGroupThreadId = 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) {
        /* nimi.runtime.v1.AgentRequestContext context = 1; */
        if (message.context)
            AgentRequestContext.internalBinaryWrite(message.context, writer.tag(1, WireType.LengthDelimited).fork(), options).join();
        /* string candidate_id = 2; */
        if (message.candidateId !== "")
            writer.tag(2, WireType.LengthDelimited).string(message.candidateId);
        /* string candidate_kind = 3; */
        if (message.candidateKind !== "")
            writer.tag(3, WireType.LengthDelimited).string(message.candidateKind);
        /* string candidate_evidence_ref = 4; */
        if (message.candidateEvidenceRef !== "")
            writer.tag(4, WireType.LengthDelimited).string(message.candidateEvidenceRef);
        /* string evidence_hash = 5; */
        if (message.evidenceHash !== "")
            writer.tag(5, WireType.LengthDelimited).string(message.evidenceHash);
        /* string runtime_trace_ref = 6; */
        if (message.runtimeTraceRef !== "")
            writer.tag(6, WireType.LengthDelimited).string(message.runtimeTraceRef);
        /* string expected_realm_group_agent_slot_id = 7; */
        if (message.expectedRealmGroupAgentSlotId !== "")
            writer.tag(7, WireType.LengthDelimited).string(message.expectedRealmGroupAgentSlotId);
        /* string expected_local_agent_ref = 8; */
        if (message.expectedLocalAgentRef !== "")
            writer.tag(8, WireType.LengthDelimited).string(message.expectedLocalAgentRef);
        /* string trigger_ref = 9; */
        if (message.triggerRef !== "")
            writer.tag(9, WireType.LengthDelimited).string(message.triggerRef);
        /* string target_realm_group_thread_id = 10; */
        if (message.targetRealmGroupThreadId !== "")
            writer.tag(10, WireType.LengthDelimited).string(message.targetRealmGroupThreadId);
        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.GetRealmGroupMessageCandidateEvidenceRequest
 */
export const GetRealmGroupMessageCandidateEvidenceRequest = new GetRealmGroupMessageCandidateEvidenceRequest$Type();
// @generated message type with reflection information, may provide speed optimized methods
class RealmGroupMessageCandidateEvidence$Type extends MessageType {
    constructor() {
        super("nimi.runtime.v1.RealmGroupMessageCandidateEvidence", [
            { no: 1, name: "candidate_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 2, name: "candidate_kind", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 3, name: "realm_group_thread_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 4, name: "realm_group_agent_slot_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 5, name: "owner_user_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 6, name: "realm_agent_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 7, name: "local_agent_ref", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 8, name: "trigger_ref", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 9, name: "output_candidate_ref", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 10, name: "evidence_hash", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 11, name: "runtime_trace_ref", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 12, name: "audit_lineage_ref", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 13, name: "policy_verdict_ref", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 14, name: "created_at", kind: "message", T: () => Timestamp },
            { no: 15, name: "expires_at", kind: "message", T: () => Timestamp },
            { no: 16, name: "commit_disposition", kind: "enum", T: () => ["nimi.runtime.v1.RealmGroupMessageCandidateCommitDisposition", RealmGroupMessageCandidateCommitDisposition, "REALM_GROUP_MESSAGE_CANDIDATE_COMMIT_DISPOSITION_"] },
            { no: 17, name: "message_type", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 18, name: "body", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 19, name: "body_hash", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 20, name: "refusal_code", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 21, name: "refusal_reason", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 22, name: "refusal_hash", kind: "scalar", T: 9 /*ScalarType.STRING*/ }
        ]);
    }
    create(value) {
        const message = globalThis.Object.create((this.messagePrototype));
        message.candidateId = "";
        message.candidateKind = "";
        message.realmGroupThreadId = "";
        message.realmGroupAgentSlotId = "";
        message.ownerUserId = "";
        message.realmAgentId = "";
        message.localAgentRef = "";
        message.triggerRef = "";
        message.outputCandidateRef = "";
        message.evidenceHash = "";
        message.runtimeTraceRef = "";
        message.auditLineageRef = "";
        message.policyVerdictRef = "";
        message.commitDisposition = 0;
        message.messageType = "";
        message.body = "";
        message.bodyHash = "";
        message.refusalCode = "";
        message.refusalReason = "";
        message.refusalHash = "";
        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 candidate_id */ 1:
                    message.candidateId = reader.string();
                    break;
                case /* string candidate_kind */ 2:
                    message.candidateKind = reader.string();
                    break;
                case /* string realm_group_thread_id */ 3:
                    message.realmGroupThreadId = reader.string();
                    break;
                case /* string realm_group_agent_slot_id */ 4:
                    message.realmGroupAgentSlotId = reader.string();
                    break;
                case /* string owner_user_id */ 5:
                    message.ownerUserId = reader.string();
                    break;
                case /* string realm_agent_id */ 6:
                    message.realmAgentId = reader.string();
                    break;
                case /* string local_agent_ref */ 7:
                    message.localAgentRef = reader.string();
                    break;
                case /* string trigger_ref */ 8:
                    message.triggerRef = reader.string();
                    break;
                case /* string output_candidate_ref */ 9:
                    message.outputCandidateRef = reader.string();
                    break;
                case /* string evidence_hash */ 10:
                    message.evidenceHash = reader.string();
                    break;
                case /* string runtime_trace_ref */ 11:
                    message.runtimeTraceRef = reader.string();
                    break;
                case /* string audit_lineage_ref */ 12:
                    message.auditLineageRef = reader.string();
                    break;
                case /* string policy_verdict_ref */ 13:
                    message.policyVerdictRef = reader.string();
                    break;
                case /* google.protobuf.Timestamp created_at */ 14:
                    message.createdAt = Timestamp.internalBinaryRead(reader, reader.uint32(), options, message.createdAt);
                    break;
                case /* google.protobuf.Timestamp expires_at */ 15:
                    message.expiresAt = Timestamp.internalBinaryRead(reader, reader.uint32(), options, message.expiresAt);
                    break;
                case /* nimi.runtime.v1.RealmGroupMessageCandidateCommitDisposition commit_disposition */ 16:
                    message.commitDisposition = reader.int32();
                    break;
                case /* string message_type */ 17:
                    message.messageType = reader.string();
                    break;
                case /* string body */ 18:
                    message.body = reader.string();
                    break;
                case /* string body_hash */ 19:
                    message.bodyHash = reader.string();
                    break;
                case /* string refusal_code */ 20:
                    message.refusalCode = reader.string();
                    break;
                case /* string refusal_reason */ 21:
                    message.refusalReason = reader.string();
                    break;
                case /* string refusal_hash */ 22:
                    message.refusalHash = 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 candidate_id = 1; */
        if (message.candidateId !== "")
            writer.tag(1, WireType.LengthDelimited).string(message.candidateId);
        /* string candidate_kind = 2; */
        if (message.candidateKind !== "")
            writer.tag(2, WireType.LengthDelimited).string(message.candidateKind);
        /* string realm_group_thread_id = 3; */
        if (message.realmGroupThreadId !== "")
            writer.tag(3, WireType.LengthDelimited).string(message.realmGroupThreadId);
        /* string realm_group_agent_slot_id = 4; */
        if (message.realmGroupAgentSlotId !== "")
            writer.tag(4, WireType.LengthDelimited).string(message.realmGroupAgentSlotId);
        /* string owner_user_id = 5; */
        if (message.ownerUserId !== "")
            writer.tag(5, WireType.LengthDelimited).string(message.ownerUserId);
        /* string realm_agent_id = 6; */
        if (message.realmAgentId !== "")
            writer.tag(6, WireType.LengthDelimited).string(message.realmAgentId);
        /* string local_agent_ref = 7; */
        if (message.localAgentRef !== "")
            writer.tag(7, WireType.LengthDelimited).string(message.localAgentRef);
        /* string trigger_ref = 8; */
        if (message.triggerRef !== "")
            writer.tag(8, WireType.LengthDelimited).string(message.triggerRef);
        /* string output_candidate_ref = 9; */
        if (message.outputCandidateRef !== "")
            writer.tag(9, WireType.LengthDelimited).string(message.outputCandidateRef);
        /* string evidence_hash = 10; */
        if (message.evidenceHash !== "")
            writer.tag(10, WireType.LengthDelimited).string(message.evidenceHash);
        /* string runtime_trace_ref = 11; */
        if (message.runtimeTraceRef !== "")
            writer.tag(11, WireType.LengthDelimited).string(message.runtimeTraceRef);
        /* string audit_lineage_ref = 12; */
        if (message.auditLineageRef !== "")
            writer.tag(12, WireType.LengthDelimited).string(message.auditLineageRef);
        /* string policy_verdict_ref = 13; */
        if (message.policyVerdictRef !== "")
            writer.tag(13, WireType.LengthDelimited).string(message.policyVerdictRef);
        /* google.protobuf.Timestamp created_at = 14; */
        if (message.createdAt)
            Timestamp.internalBinaryWrite(message.createdAt, writer.tag(14, WireType.LengthDelimited).fork(), options).join();
        /* google.protobuf.Timestamp expires_at = 15; */
        if (message.expiresAt)
            Timestamp.internalBinaryWrite(message.expiresAt, writer.tag(15, WireType.LengthDelimited).fork(), options).join();
        /* nimi.runtime.v1.RealmGroupMessageCandidateCommitDisposition commit_disposition = 16; */
        if (message.commitDisposition !== 0)
            writer.tag(16, WireType.Varint).int32(message.commitDisposition);
        /* string message_type = 17; */
        if (message.messageType !== "")
            writer.tag(17, WireType.LengthDelimited).string(message.messageType);
        /* string body = 18; */
        if (message.body !== "")
            writer.tag(18, WireType.LengthDelimited).string(message.body);
        /* string body_hash = 19; */
        if (message.bodyHash !== "")
            writer.tag(19, WireType.LengthDelimited).string(message.bodyHash);
        /* string refusal_code = 20; */
        if (message.refusalCode !== "")
            writer.tag(20, WireType.LengthDelimited).string(message.refusalCode);
        /* string refusal_reason = 21; */
        if (message.refusalReason !== "")
            writer.tag(21, WireType.LengthDelimited).string(message.refusalReason);
        /* string refusal_hash = 22; */
        if (message.refusalHash !== "")
            writer.tag(22, WireType.LengthDelimited).string(message.refusalHash);
        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.RealmGroupMessageCandidateEvidence
 */
export const RealmGroupMessageCandidateEvidence = new RealmGroupMessageCandidateEvidence$Type();
// @generated message type with reflection information, may provide speed optimized methods
class GetRealmGroupMessageCandidateEvidenceResponse$Type extends MessageType {
    constructor() {
        super("nimi.runtime.v1.GetRealmGroupMessageCandidateEvidenceResponse", [
            { no: 1, name: "evidence", kind: "message", T: () => RealmGroupMessageCandidateEvidence }
        ]);
    }
    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.RealmGroupMessageCandidateEvidence evidence */ 1:
                    message.evidence = RealmGroupMessageCandidateEvidence.internalBinaryRead(reader, reader.uint32(), options, message.evidence);
                    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.RealmGroupMessageCandidateEvidence evidence = 1; */
        if (message.evidence)
            RealmGroupMessageCandidateEvidence.internalBinaryWrite(message.evidence, 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.GetRealmGroupMessageCandidateEvidenceResponse
 */
export const GetRealmGroupMessageCandidateEvidenceResponse = new GetRealmGroupMessageCandidateEvidenceResponse$Type();
//# sourceMappingURL=agent_group_message_candidate.js.map