// @generated by protoc-gen-es v1.7.2 with parameter "target=ts"
// @generated from file trace.proto (package rs.tokio.console.trace, syntax proto3)
/* eslint-disable */
// @ts-nocheck

import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from "@bufbuild/protobuf";
import { Message, proto3, protoInt64, Timestamp } from "@bufbuild/protobuf";
import { RegisterMetadata, Span, SpanId } from "./common_pb.js";

/**
 * Start watching trace events with the provided filter.
 *
 * @generated from message rs.tokio.console.trace.WatchRequest
 */
export class WatchRequest extends Message<WatchRequest> {
  /**
   * Specifies which trace events should be streamed.
   *
   * @generated from field: string filter = 1;
   */
  filter = "";

  constructor(data?: PartialMessage<WatchRequest>) {
    super();
    proto3.util.initPartial(data, this);
  }

  static readonly runtime: typeof proto3 = proto3;
  static readonly typeName = "rs.tokio.console.trace.WatchRequest";
  static readonly fields: FieldList = proto3.util.newFieldList(() => [
    { no: 1, name: "filter", kind: "scalar", T: 9 /* ScalarType.STRING */ },
  ]);

  static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): WatchRequest {
    return new WatchRequest().fromBinary(bytes, options);
  }

  static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): WatchRequest {
    return new WatchRequest().fromJson(jsonValue, options);
  }

  static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): WatchRequest {
    return new WatchRequest().fromJsonString(jsonString, options);
  }

  static equals(a: WatchRequest | PlainMessage<WatchRequest> | undefined, b: WatchRequest | PlainMessage<WatchRequest> | undefined): boolean {
    return proto3.util.equals(WatchRequest, a, b);
  }
}

/**
 * A trace event
 *
 * @generated from message rs.tokio.console.trace.TraceEvent
 */
export class TraceEvent extends Message<TraceEvent> {
  /**
   * A trace event
   *
   * @generated from oneof rs.tokio.console.trace.TraceEvent.event
   */
  event: {
    /**
     * A new thread was registered.
     *
     * @generated from field: rs.tokio.console.trace.TraceEvent.RegisterThreads register_thread = 1;
     */
    value: TraceEvent_RegisterThreads;
    case: "registerThread";
  } | {
    /**
     * A new span metadata was registered.
     *
     * @generated from field: rs.tokio.console.common.RegisterMetadata register_metadata = 2;
     */
    value: RegisterMetadata;
    case: "registerMetadata";
  } | {
    /**
     * A span was created.
     *
     * @generated from field: rs.tokio.console.common.Span new_span = 3;
     */
    value: Span;
    case: "newSpan";
  } | {
    /**
     * A span was entered.
     *
     * @generated from field: rs.tokio.console.trace.TraceEvent.Enter enter_span = 4;
     */
    value: TraceEvent_Enter;
    case: "enterSpan";
  } | {
    /**
     * A span was exited.
     *
     * @generated from field: rs.tokio.console.trace.TraceEvent.Exit exit_span = 5;
     */
    value: TraceEvent_Exit;
    case: "exitSpan";
  } | {
    /**
     * A span was closed.
     *
     * @generated from field: rs.tokio.console.trace.TraceEvent.Close close_span = 6;
     */
    value: TraceEvent_Close;
    case: "closeSpan";
  } | { case: undefined; value?: undefined } = { case: undefined };

  constructor(data?: PartialMessage<TraceEvent>) {
    super();
    proto3.util.initPartial(data, this);
  }

  static readonly runtime: typeof proto3 = proto3;
  static readonly typeName = "rs.tokio.console.trace.TraceEvent";
  static readonly fields: FieldList = proto3.util.newFieldList(() => [
    { no: 1, name: "register_thread", kind: "message", T: TraceEvent_RegisterThreads, oneof: "event" },
    { no: 2, name: "register_metadata", kind: "message", T: RegisterMetadata, oneof: "event" },
    { no: 3, name: "new_span", kind: "message", T: Span, oneof: "event" },
    { no: 4, name: "enter_span", kind: "message", T: TraceEvent_Enter, oneof: "event" },
    { no: 5, name: "exit_span", kind: "message", T: TraceEvent_Exit, oneof: "event" },
    { no: 6, name: "close_span", kind: "message", T: TraceEvent_Close, oneof: "event" },
  ]);

  static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): TraceEvent {
    return new TraceEvent().fromBinary(bytes, options);
  }

  static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): TraceEvent {
    return new TraceEvent().fromJson(jsonValue, options);
  }

  static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): TraceEvent {
    return new TraceEvent().fromJsonString(jsonString, options);
  }

  static equals(a: TraceEvent | PlainMessage<TraceEvent> | undefined, b: TraceEvent | PlainMessage<TraceEvent> | undefined): boolean {
    return proto3.util.equals(TraceEvent, a, b);
  }
}

/**
 * `RegisterThreads` signals that a new thread was registered.
 *
 * @generated from message rs.tokio.console.trace.TraceEvent.RegisterThreads
 */
export class TraceEvent_RegisterThreads extends Message<TraceEvent_RegisterThreads> {
  /**
   * `names` maps the registered thread id's to their associated name.
   *
   * @generated from field: map<uint64, string> names = 1;
   */
  names: { [key: string]: string } = {};

  constructor(data?: PartialMessage<TraceEvent_RegisterThreads>) {
    super();
    proto3.util.initPartial(data, this);
  }

  static readonly runtime: typeof proto3 = proto3;
  static readonly typeName = "rs.tokio.console.trace.TraceEvent.RegisterThreads";
  static readonly fields: FieldList = proto3.util.newFieldList(() => [
    { no: 1, name: "names", kind: "map", K: 4 /* ScalarType.UINT64 */, V: {kind: "scalar", T: 9 /* ScalarType.STRING */} },
  ]);

  static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): TraceEvent_RegisterThreads {
    return new TraceEvent_RegisterThreads().fromBinary(bytes, options);
  }

  static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): TraceEvent_RegisterThreads {
    return new TraceEvent_RegisterThreads().fromJson(jsonValue, options);
  }

  static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): TraceEvent_RegisterThreads {
    return new TraceEvent_RegisterThreads().fromJsonString(jsonString, options);
  }

  static equals(a: TraceEvent_RegisterThreads | PlainMessage<TraceEvent_RegisterThreads> | undefined, b: TraceEvent_RegisterThreads | PlainMessage<TraceEvent_RegisterThreads> | undefined): boolean {
    return proto3.util.equals(TraceEvent_RegisterThreads, a, b);
  }
}

/**
 * `Enter` signals that a span was entered.
 *
 * @generated from message rs.tokio.console.trace.TraceEvent.Enter
 */
export class TraceEvent_Enter extends Message<TraceEvent_Enter> {
  /**
   * `span_id` identifies the span that was entered.
   *
   * @generated from field: rs.tokio.console.common.SpanId span_id = 1;
   */
  spanId?: SpanId;

  /**
   * `thread_id` identifies who entered the span.
   *
   * @generated from field: uint64 thread_id = 2;
   */
  threadId = protoInt64.zero;

  /**
   * `at` identifies when the span was entered.
   *
   * @generated from field: google.protobuf.Timestamp at = 3;
   */
  at?: Timestamp;

  constructor(data?: PartialMessage<TraceEvent_Enter>) {
    super();
    proto3.util.initPartial(data, this);
  }

  static readonly runtime: typeof proto3 = proto3;
  static readonly typeName = "rs.tokio.console.trace.TraceEvent.Enter";
  static readonly fields: FieldList = proto3.util.newFieldList(() => [
    { no: 1, name: "span_id", kind: "message", T: SpanId },
    { no: 2, name: "thread_id", kind: "scalar", T: 4 /* ScalarType.UINT64 */ },
    { no: 3, name: "at", kind: "message", T: Timestamp },
  ]);

  static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): TraceEvent_Enter {
    return new TraceEvent_Enter().fromBinary(bytes, options);
  }

  static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): TraceEvent_Enter {
    return new TraceEvent_Enter().fromJson(jsonValue, options);
  }

  static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): TraceEvent_Enter {
    return new TraceEvent_Enter().fromJsonString(jsonString, options);
  }

  static equals(a: TraceEvent_Enter | PlainMessage<TraceEvent_Enter> | undefined, b: TraceEvent_Enter | PlainMessage<TraceEvent_Enter> | undefined): boolean {
    return proto3.util.equals(TraceEvent_Enter, a, b);
  }
}

/**
 * `Exit` signals that a span was exited.
 *
 * @generated from message rs.tokio.console.trace.TraceEvent.Exit
 */
export class TraceEvent_Exit extends Message<TraceEvent_Exit> {
  /**
   * `span_id` identifies the span that was exited.
   *
   * @generated from field: rs.tokio.console.common.SpanId span_id = 1;
   */
  spanId?: SpanId;

  /**
   * `thread_id` identifies who exited the span.
   *
   * @generated from field: uint64 thread_id = 2;
   */
  threadId = protoInt64.zero;

  /**
   * `at` identifies when the span was exited.
   *
   * @generated from field: google.protobuf.Timestamp at = 3;
   */
  at?: Timestamp;

  constructor(data?: PartialMessage<TraceEvent_Exit>) {
    super();
    proto3.util.initPartial(data, this);
  }

  static readonly runtime: typeof proto3 = proto3;
  static readonly typeName = "rs.tokio.console.trace.TraceEvent.Exit";
  static readonly fields: FieldList = proto3.util.newFieldList(() => [
    { no: 1, name: "span_id", kind: "message", T: SpanId },
    { no: 2, name: "thread_id", kind: "scalar", T: 4 /* ScalarType.UINT64 */ },
    { no: 3, name: "at", kind: "message", T: Timestamp },
  ]);

  static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): TraceEvent_Exit {
    return new TraceEvent_Exit().fromBinary(bytes, options);
  }

  static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): TraceEvent_Exit {
    return new TraceEvent_Exit().fromJson(jsonValue, options);
  }

  static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): TraceEvent_Exit {
    return new TraceEvent_Exit().fromJsonString(jsonString, options);
  }

  static equals(a: TraceEvent_Exit | PlainMessage<TraceEvent_Exit> | undefined, b: TraceEvent_Exit | PlainMessage<TraceEvent_Exit> | undefined): boolean {
    return proto3.util.equals(TraceEvent_Exit, a, b);
  }
}

/**
 * `Close` signals that a span was closed.
 *
 * @generated from message rs.tokio.console.trace.TraceEvent.Close
 */
export class TraceEvent_Close extends Message<TraceEvent_Close> {
  /**
   * `span_id` identifies the span that was closed.
   *
   * @generated from field: rs.tokio.console.common.SpanId span_id = 1;
   */
  spanId?: SpanId;

  /**
   * `at` identifies when the span was closed.
   *
   * @generated from field: google.protobuf.Timestamp at = 2;
   */
  at?: Timestamp;

  constructor(data?: PartialMessage<TraceEvent_Close>) {
    super();
    proto3.util.initPartial(data, this);
  }

  static readonly runtime: typeof proto3 = proto3;
  static readonly typeName = "rs.tokio.console.trace.TraceEvent.Close";
  static readonly fields: FieldList = proto3.util.newFieldList(() => [
    { no: 1, name: "span_id", kind: "message", T: SpanId },
    { no: 2, name: "at", kind: "message", T: Timestamp },
  ]);

  static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): TraceEvent_Close {
    return new TraceEvent_Close().fromBinary(bytes, options);
  }

  static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): TraceEvent_Close {
    return new TraceEvent_Close().fromJson(jsonValue, options);
  }

  static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): TraceEvent_Close {
    return new TraceEvent_Close().fromJsonString(jsonString, options);
  }

  static equals(a: TraceEvent_Close | PlainMessage<TraceEvent_Close> | undefined, b: TraceEvent_Close | PlainMessage<TraceEvent_Close> | undefined): boolean {
    return proto3.util.equals(TraceEvent_Close, a, b);
  }
}

