// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
// versions:
//   protoc-gen-ts_proto  v2.11.2
//   protoc               v3.20.3
// source: gql_service.proto

/* eslint-disable */
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
import {
  type CallOptions,
  type ChannelCredentials,
  Client,
  type ClientOptions,
  type ClientReadableStream,
  type ClientUnaryCall,
  type handleServerStreamingCall,
  type handleUnaryCall,
  makeGenericClientConstructor,
  type Metadata,
  type ServiceError,
  type UntypedServiceImplementation,
} from "@grpc/grpc-js";
import { AuthCredentials, GqlStatus, TypeDescriptor, Value } from "./gql_types";

export const protobufPackage = "gql";

export enum ResetTarget {
  RESET_ALL = 0,
  RESET_SCHEMA = 1,
  RESET_GRAPH = 2,
  RESET_TIME_ZONE = 3,
  RESET_PARAMETERS = 4,
  UNRECOGNIZED = -1,
}

export function resetTargetFromJSON(object: any): ResetTarget {
  switch (object) {
    case 0:
    case "RESET_ALL":
      return ResetTarget.RESET_ALL;
    case 1:
    case "RESET_SCHEMA":
      return ResetTarget.RESET_SCHEMA;
    case 2:
    case "RESET_GRAPH":
      return ResetTarget.RESET_GRAPH;
    case 3:
    case "RESET_TIME_ZONE":
      return ResetTarget.RESET_TIME_ZONE;
    case 4:
    case "RESET_PARAMETERS":
      return ResetTarget.RESET_PARAMETERS;
    case -1:
    case "UNRECOGNIZED":
    default:
      return ResetTarget.UNRECOGNIZED;
  }
}

export function resetTargetToJSON(object: ResetTarget): string {
  switch (object) {
    case ResetTarget.RESET_ALL:
      return "RESET_ALL";
    case ResetTarget.RESET_SCHEMA:
      return "RESET_SCHEMA";
    case ResetTarget.RESET_GRAPH:
      return "RESET_GRAPH";
    case ResetTarget.RESET_TIME_ZONE:
      return "RESET_TIME_ZONE";
    case ResetTarget.RESET_PARAMETERS:
      return "RESET_PARAMETERS";
    case ResetTarget.UNRECOGNIZED:
    default:
      return "UNRECOGNIZED";
  }
}

export enum ResultType {
  BINDING_TABLE = 0,
  GRAPH = 1,
  OMITTED = 2,
  UNRECOGNIZED = -1,
}

export function resultTypeFromJSON(object: any): ResultType {
  switch (object) {
    case 0:
    case "BINDING_TABLE":
      return ResultType.BINDING_TABLE;
    case 1:
    case "GRAPH":
      return ResultType.GRAPH;
    case 2:
    case "OMITTED":
      return ResultType.OMITTED;
    case -1:
    case "UNRECOGNIZED":
    default:
      return ResultType.UNRECOGNIZED;
  }
}

export function resultTypeToJSON(object: ResultType): string {
  switch (object) {
    case ResultType.BINDING_TABLE:
      return "BINDING_TABLE";
    case ResultType.GRAPH:
      return "GRAPH";
    case ResultType.OMITTED:
      return "OMITTED";
    case ResultType.UNRECOGNIZED:
    default:
      return "UNRECOGNIZED";
  }
}

export enum TransactionMode {
  READ_WRITE = 0,
  READ_ONLY = 1,
  UNRECOGNIZED = -1,
}

export function transactionModeFromJSON(object: any): TransactionMode {
  switch (object) {
    case 0:
    case "READ_WRITE":
      return TransactionMode.READ_WRITE;
    case 1:
    case "READ_ONLY":
      return TransactionMode.READ_ONLY;
    case -1:
    case "UNRECOGNIZED":
    default:
      return TransactionMode.UNRECOGNIZED;
  }
}

export function transactionModeToJSON(object: TransactionMode): string {
  switch (object) {
    case TransactionMode.READ_WRITE:
      return "READ_WRITE";
    case TransactionMode.READ_ONLY:
      return "READ_ONLY";
    case TransactionMode.UNRECOGNIZED:
    default:
      return "UNRECOGNIZED";
  }
}

export interface HandshakeRequest {
  protocolVersion: number;
  credentials:
    | AuthCredentials
    | undefined;
  /** Driver name, version, platform */
  clientInfo: { [key: string]: string };
}

export interface HandshakeRequest_ClientInfoEntry {
  key: string;
  value: string;
}

export interface HandshakeResponse {
  protocolVersion: number;
  sessionId: string;
  serverInfo:
    | ServerInfo
    | undefined;
  /** Implementation limits (IL codes) */
  limits: { [key: string]: bigint };
}

export interface HandshakeResponse_LimitsEntry {
  key: string;
  value: bigint;
}

export interface ServerInfo {
  name: string;
  version: string;
  features: string[];
}

export interface ConfigureRequest {
  sessionId: string;
  schema?: string | undefined;
  graph?: string | undefined;
  timeZoneOffsetMinutes?: number | undefined;
  parameter?: SessionParameter | undefined;
}

export interface SessionParameter {
  name: string;
  value: Value | undefined;
}

export interface ConfigureResponse {
}

export interface ResetRequest {
  sessionId: string;
  target: ResetTarget;
}

export interface ResetResponse {
}

export interface CloseRequest {
  sessionId: string;
}

export interface CloseResponse {
}

export interface PingRequest {
  sessionId: string;
}

export interface PongResponse {
  timestamp: bigint;
}

export interface ExecuteRequest {
  sessionId: string;
  statement: string;
  parameters: { [key: string]: Value };
  /** Omit for auto-commit */
  transactionId?: string | undefined;
}

export interface ExecuteRequest_ParametersEntry {
  key: string;
  value: Value | undefined;
}

export interface ExecuteResponse {
  header?: ResultHeader | undefined;
  rowBatch?: RowBatch | undefined;
  summary?: ResultSummary | undefined;
}

/** First frame: describes what kind of result follows. */
export interface ResultHeader {
  resultType: ResultType;
  columns: ColumnDescriptor[];
  /** Whether row order is semantically meaningful (sec 4.3.6) */
  ordered: boolean;
}

export interface ColumnDescriptor {
  name: string;
  type: TypeDescriptor | undefined;
}

/** Data frames: batched rows. */
export interface RowBatch {
  rows: Row[];
}

export interface Row {
  /** Positional, matches column order from header */
  values: Value[];
}

/** Final frame: completion status and statistics. */
export interface ResultSummary {
  status: GqlStatus | undefined;
  warnings: GqlStatus[];
  rowsAffected: bigint;
  /** nodes_created, edges_deleted, etc. */
  counters: { [key: string]: bigint };
}

export interface ResultSummary_CountersEntry {
  key: string;
  value: bigint;
}

export interface BeginRequest {
  sessionId: string;
  mode: TransactionMode;
}

export interface BeginResponse {
  transactionId: string;
  status: GqlStatus | undefined;
}

export interface CommitRequest {
  sessionId: string;
  transactionId: string;
}

export interface CommitResponse {
  status: GqlStatus | undefined;
}

export interface RollbackRequest {
  sessionId: string;
  transactionId: string;
}

export interface RollbackResponse {
  status: GqlStatus | undefined;
}

export interface ListSchemasRequest {
}

export interface SchemaInfo {
  name: string;
  graphCount: number;
  graphTypeCount: number;
}

export interface ListSchemasResponse {
  schemas: SchemaInfo[];
}

export interface CreateSchemaRequest {
  name: string;
  ifNotExists: boolean;
}

export interface CreateSchemaResponse {
}

export interface DropSchemaRequest {
  name: string;
  ifExists: boolean;
}

export interface DropSchemaResponse {
  existed: boolean;
}

export interface ListGraphsRequest {
  /** Schema to list graphs from */
  schema: string;
}

export interface GraphSummary {
  schema: string;
  name: string;
  nodeCount: bigint;
  edgeCount: bigint;
  /** Graph type name (empty if open) */
  graphType: string;
}

export interface ListGraphsResponse {
  graphs: GraphSummary[];
}

export interface CreateGraphRequest {
  schema: string;
  name: string;
  ifNotExists: boolean;
  orReplace: boolean;
  /** true = ANY GRAPH (open graph type) */
  openType?:
    | boolean
    | undefined;
  /** Reference to a named graph type */
  graphTypeRef?:
    | string
    | undefined;
  /** Optional: copy contents from source graph */
  copyOf?:
    | string
    | undefined;
  /** Engine-specific options (GrafeoDB extensions) */
  storageMode: string;
  options: GraphOptions | undefined;
}

export interface GraphOptions {
  memoryLimitBytes?: bigint | undefined;
  backwardEdges?: boolean | undefined;
  threads?: number | undefined;
  walEnabled?: boolean | undefined;
  walDurability?: string | undefined;
}

export interface CreateGraphResponse {
  graph: GraphSummary | undefined;
}

export interface DropGraphRequest {
  schema: string;
  name: string;
  ifExists: boolean;
}

export interface DropGraphResponse {
  existed: boolean;
}

export interface GetGraphInfoRequest {
  schema: string;
  name: string;
}

export interface GetGraphInfoResponse {
  schema: string;
  name: string;
  nodeCount: bigint;
  edgeCount: bigint;
  graphType: string;
  storageMode: string;
  memoryLimitBytes: bigint;
  backwardEdges: boolean;
  threads: number;
}

export interface ListGraphTypesRequest {
  schema: string;
}

export interface GraphTypeInfo {
  schema: string;
  name: string;
}

export interface ListGraphTypesResponse {
  graphTypes: GraphTypeInfo[];
}

export interface CreateGraphTypeRequest {
  schema: string;
  name: string;
  ifNotExists: boolean;
  orReplace: boolean;
}

export interface CreateGraphTypeResponse {
}

export interface DropGraphTypeRequest {
  schema: string;
  name: string;
  ifExists: boolean;
}

export interface DropGraphTypeResponse {
  existed: boolean;
}

export interface GetGraphStatsRequest {
  graph: string;
}

export interface GetGraphStatsResponse {
  nodeCount: bigint;
  edgeCount: bigint;
  labelCount: bigint;
  edgeTypeCount: bigint;
  propertyKeyCount: bigint;
  indexCount: bigint;
  memoryBytes: bigint;
  diskBytes?: bigint | undefined;
}

export interface WalStatusRequest {
  graph: string;
}

export interface WalStatusResponse {
  enabled: boolean;
  path?: string | undefined;
  sizeBytes: bigint;
  recordCount: bigint;
  lastCheckpoint?: bigint | undefined;
  currentEpoch: bigint;
}

export interface WalCheckpointRequest {
  graph: string;
}

export interface WalCheckpointResponse {
}

export interface ValidateRequest {
  graph: string;
}

export interface ValidateResponse {
  valid: boolean;
  errors: ValidationError[];
  warnings: ValidationWarning[];
}

export interface ValidationError {
  code: string;
  message: string;
  context?: string | undefined;
}

export interface ValidationWarning {
  code: string;
  message: string;
  context?: string | undefined;
}

export interface CreateIndexRequest {
  graph: string;
  propertyIndex?: PropertyIndexDef | undefined;
  vectorIndex?: VectorIndexDef | undefined;
  textIndex?: TextIndexDef | undefined;
}

export interface PropertyIndexDef {
  property: string;
}

export interface VectorIndexDef {
  label: string;
  property: string;
  dimensions?:
    | number
    | undefined;
  /** cosine, euclidean, dot_product, manhattan */
  metric?:
    | string
    | undefined;
  /** HNSW links per node */
  m?: number | undefined;
  efConstruction?: number | undefined;
}

export interface TextIndexDef {
  label: string;
  property: string;
}

export interface CreateIndexResponse {
}

export interface DropIndexRequest {
  graph: string;
  propertyIndex?: PropertyIndexDef | undefined;
  vectorIndex?: VectorIndexDef | undefined;
  textIndex?: TextIndexDef | undefined;
}

export interface DropIndexResponse {
  existed: boolean;
}

export interface VectorSearchRequest {
  graph: string;
  label: string;
  property: string;
  queryVector: number[];
  k: number;
  ef?: number | undefined;
  filters: { [key: string]: Value };
}

export interface VectorSearchRequest_FiltersEntry {
  key: string;
  value: Value | undefined;
}

export interface TextSearchRequest {
  graph: string;
  label: string;
  property: string;
  query: string;
  k: number;
}

export interface HybridSearchRequest {
  graph: string;
  label: string;
  textProperty: string;
  vectorProperty: string;
  queryText: string;
  queryVector: number[];
  k: number;
}

/**
 * A single search result. node_id is an internal numeric identifier
 * (not the opaque bytes element ID from the GQL type system).
 */
export interface SearchHit {
  nodeId: bigint;
  score: number;
  properties: { [key: string]: Value };
}

export interface SearchHit_PropertiesEntry {
  key: string;
  value: Value | undefined;
}

export interface VectorSearchResponse {
  hits: SearchHit[];
}

export interface TextSearchResponse {
  hits: SearchHit[];
}

export interface HybridSearchResponse {
  hits: SearchHit[];
}

function createBaseHandshakeRequest(): HandshakeRequest {
  return { protocolVersion: 0, credentials: undefined, clientInfo: {} };
}

export const HandshakeRequest: MessageFns<HandshakeRequest> = {
  encode(message: HandshakeRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
    if (message.protocolVersion !== 0) {
      writer.uint32(8).uint32(message.protocolVersion);
    }
    if (message.credentials !== undefined) {
      AuthCredentials.encode(message.credentials, writer.uint32(18).fork()).join();
    }
    globalThis.Object.entries(message.clientInfo).forEach(([key, value]: [string, string]) => {
      HandshakeRequest_ClientInfoEntry.encode({ key: key as any, value }, writer.uint32(26).fork()).join();
    });
    return writer;
  },

  decode(input: BinaryReader | Uint8Array, length?: number): HandshakeRequest {
    const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
    const end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseHandshakeRequest();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1: {
          if (tag !== 8) {
            break;
          }

          message.protocolVersion = reader.uint32();
          continue;
        }
        case 2: {
          if (tag !== 18) {
            break;
          }

          message.credentials = AuthCredentials.decode(reader, reader.uint32());
          continue;
        }
        case 3: {
          if (tag !== 26) {
            break;
          }

          const entry3 = HandshakeRequest_ClientInfoEntry.decode(reader, reader.uint32());
          if (entry3.value !== undefined) {
            message.clientInfo[entry3.key] = entry3.value;
          }
          continue;
        }
      }
      if ((tag & 7) === 4 || tag === 0) {
        break;
      }
      reader.skip(tag & 7);
    }
    return message;
  },

  fromJSON(object: any): HandshakeRequest {
    return {
      protocolVersion: isSet(object.protocolVersion)
        ? globalThis.Number(object.protocolVersion)
        : isSet(object.protocol_version)
        ? globalThis.Number(object.protocol_version)
        : 0,
      credentials: isSet(object.credentials) ? AuthCredentials.fromJSON(object.credentials) : undefined,
      clientInfo: isObject(object.clientInfo)
        ? (globalThis.Object.entries(object.clientInfo) as [string, any][]).reduce(
          (acc: { [key: string]: string }, [key, value]: [string, any]) => {
            acc[key] = globalThis.String(value);
            return acc;
          },
          {},
        )
        : isObject(object.client_info)
        ? (globalThis.Object.entries(object.client_info) as [string, any][]).reduce(
          (acc: { [key: string]: string }, [key, value]: [string, any]) => {
            acc[key] = globalThis.String(value);
            return acc;
          },
          {},
        )
        : {},
    };
  },

  toJSON(message: HandshakeRequest): unknown {
    const obj: any = {};
    if (message.protocolVersion !== 0) {
      obj.protocolVersion = Math.round(message.protocolVersion);
    }
    if (message.credentials !== undefined) {
      obj.credentials = AuthCredentials.toJSON(message.credentials);
    }
    if (message.clientInfo) {
      const entries = globalThis.Object.entries(message.clientInfo) as [string, string][];
      if (entries.length > 0) {
        obj.clientInfo = {};
        entries.forEach(([k, v]) => {
          obj.clientInfo[k] = v;
        });
      }
    }
    return obj;
  },

  create<I extends Exact<DeepPartial<HandshakeRequest>, I>>(base?: I): HandshakeRequest {
    return HandshakeRequest.fromPartial(base ?? ({} as any));
  },
  fromPartial<I extends Exact<DeepPartial<HandshakeRequest>, I>>(object: I): HandshakeRequest {
    const message = createBaseHandshakeRequest();
    message.protocolVersion = object.protocolVersion ?? 0;
    message.credentials = (object.credentials !== undefined && object.credentials !== null)
      ? AuthCredentials.fromPartial(object.credentials)
      : undefined;
    message.clientInfo = (globalThis.Object.entries(object.clientInfo ?? {}) as [string, string][]).reduce(
      (acc: { [key: string]: string }, [key, value]: [string, string]) => {
        if (value !== undefined) {
          acc[key] = globalThis.String(value);
        }
        return acc;
      },
      {},
    );
    return message;
  },
};

function createBaseHandshakeRequest_ClientInfoEntry(): HandshakeRequest_ClientInfoEntry {
  return { key: "", value: "" };
}

export const HandshakeRequest_ClientInfoEntry: MessageFns<HandshakeRequest_ClientInfoEntry> = {
  encode(message: HandshakeRequest_ClientInfoEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
    if (message.key !== "") {
      writer.uint32(10).string(message.key);
    }
    if (message.value !== "") {
      writer.uint32(18).string(message.value);
    }
    return writer;
  },

  decode(input: BinaryReader | Uint8Array, length?: number): HandshakeRequest_ClientInfoEntry {
    const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
    const end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseHandshakeRequest_ClientInfoEntry();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1: {
          if (tag !== 10) {
            break;
          }

          message.key = reader.string();
          continue;
        }
        case 2: {
          if (tag !== 18) {
            break;
          }

          message.value = reader.string();
          continue;
        }
      }
      if ((tag & 7) === 4 || tag === 0) {
        break;
      }
      reader.skip(tag & 7);
    }
    return message;
  },

  fromJSON(object: any): HandshakeRequest_ClientInfoEntry {
    return {
      key: isSet(object.key) ? globalThis.String(object.key) : "",
      value: isSet(object.value) ? globalThis.String(object.value) : "",
    };
  },

  toJSON(message: HandshakeRequest_ClientInfoEntry): unknown {
    const obj: any = {};
    if (message.key !== "") {
      obj.key = message.key;
    }
    if (message.value !== "") {
      obj.value = message.value;
    }
    return obj;
  },

  create<I extends Exact<DeepPartial<HandshakeRequest_ClientInfoEntry>, I>>(
    base?: I,
  ): HandshakeRequest_ClientInfoEntry {
    return HandshakeRequest_ClientInfoEntry.fromPartial(base ?? ({} as any));
  },
  fromPartial<I extends Exact<DeepPartial<HandshakeRequest_ClientInfoEntry>, I>>(
    object: I,
  ): HandshakeRequest_ClientInfoEntry {
    const message = createBaseHandshakeRequest_ClientInfoEntry();
    message.key = object.key ?? "";
    message.value = object.value ?? "";
    return message;
  },
};

function createBaseHandshakeResponse(): HandshakeResponse {
  return { protocolVersion: 0, sessionId: "", serverInfo: undefined, limits: {} };
}

export const HandshakeResponse: MessageFns<HandshakeResponse> = {
  encode(message: HandshakeResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
    if (message.protocolVersion !== 0) {
      writer.uint32(8).uint32(message.protocolVersion);
    }
    if (message.sessionId !== "") {
      writer.uint32(18).string(message.sessionId);
    }
    if (message.serverInfo !== undefined) {
      ServerInfo.encode(message.serverInfo, writer.uint32(26).fork()).join();
    }
    globalThis.Object.entries(message.limits).forEach(([key, value]: [string, bigint]) => {
      HandshakeResponse_LimitsEntry.encode({ key: key as any, value }, writer.uint32(34).fork()).join();
    });
    return writer;
  },

  decode(input: BinaryReader | Uint8Array, length?: number): HandshakeResponse {
    const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
    const end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseHandshakeResponse();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1: {
          if (tag !== 8) {
            break;
          }

          message.protocolVersion = reader.uint32();
          continue;
        }
        case 2: {
          if (tag !== 18) {
            break;
          }

          message.sessionId = reader.string();
          continue;
        }
        case 3: {
          if (tag !== 26) {
            break;
          }

          message.serverInfo = ServerInfo.decode(reader, reader.uint32());
          continue;
        }
        case 4: {
          if (tag !== 34) {
            break;
          }

          const entry4 = HandshakeResponse_LimitsEntry.decode(reader, reader.uint32());
          if (entry4.value !== undefined) {
            message.limits[entry4.key] = entry4.value;
          }
          continue;
        }
      }
      if ((tag & 7) === 4 || tag === 0) {
        break;
      }
      reader.skip(tag & 7);
    }
    return message;
  },

  fromJSON(object: any): HandshakeResponse {
    return {
      protocolVersion: isSet(object.protocolVersion)
        ? globalThis.Number(object.protocolVersion)
        : isSet(object.protocol_version)
        ? globalThis.Number(object.protocol_version)
        : 0,
      sessionId: isSet(object.sessionId)
        ? globalThis.String(object.sessionId)
        : isSet(object.session_id)
        ? globalThis.String(object.session_id)
        : "",
      serverInfo: isSet(object.serverInfo)
        ? ServerInfo.fromJSON(object.serverInfo)
        : isSet(object.server_info)
        ? ServerInfo.fromJSON(object.server_info)
        : undefined,
      limits: isObject(object.limits)
        ? (globalThis.Object.entries(object.limits) as [string, any][]).reduce(
          (acc: { [key: string]: bigint }, [key, value]: [string, any]) => {
            acc[key] = BigInt(value as string | number | bigint | boolean);
            return acc;
          },
          {},
        )
        : {},
    };
  },

  toJSON(message: HandshakeResponse): unknown {
    const obj: any = {};
    if (message.protocolVersion !== 0) {
      obj.protocolVersion = Math.round(message.protocolVersion);
    }
    if (message.sessionId !== "") {
      obj.sessionId = message.sessionId;
    }
    if (message.serverInfo !== undefined) {
      obj.serverInfo = ServerInfo.toJSON(message.serverInfo);
    }
    if (message.limits) {
      const entries = globalThis.Object.entries(message.limits) as [string, bigint][];
      if (entries.length > 0) {
        obj.limits = {};
        entries.forEach(([k, v]) => {
          obj.limits[k] = v.toString();
        });
      }
    }
    return obj;
  },

  create<I extends Exact<DeepPartial<HandshakeResponse>, I>>(base?: I): HandshakeResponse {
    return HandshakeResponse.fromPartial(base ?? ({} as any));
  },
  fromPartial<I extends Exact<DeepPartial<HandshakeResponse>, I>>(object: I): HandshakeResponse {
    const message = createBaseHandshakeResponse();
    message.protocolVersion = object.protocolVersion ?? 0;
    message.sessionId = object.sessionId ?? "";
    message.serverInfo = (object.serverInfo !== undefined && object.serverInfo !== null)
      ? ServerInfo.fromPartial(object.serverInfo)
      : undefined;
    message.limits = (globalThis.Object.entries(object.limits ?? {}) as [string, bigint][]).reduce(
      (acc: { [key: string]: bigint }, [key, value]: [string, bigint]) => {
        if (value !== undefined) {
          acc[key] = BigInt(value as string | number | bigint | boolean);
        }
        return acc;
      },
      {},
    );
    return message;
  },
};

function createBaseHandshakeResponse_LimitsEntry(): HandshakeResponse_LimitsEntry {
  return { key: "", value: 0n };
}

export const HandshakeResponse_LimitsEntry: MessageFns<HandshakeResponse_LimitsEntry> = {
  encode(message: HandshakeResponse_LimitsEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
    if (message.key !== "") {
      writer.uint32(10).string(message.key);
    }
    if (message.value !== 0n) {
      if (BigInt.asIntN(64, message.value) !== message.value) {
        throw new globalThis.Error("value provided for field message.value of type int64 too large");
      }
      writer.uint32(16).int64(message.value);
    }
    return writer;
  },

  decode(input: BinaryReader | Uint8Array, length?: number): HandshakeResponse_LimitsEntry {
    const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
    const end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseHandshakeResponse_LimitsEntry();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1: {
          if (tag !== 10) {
            break;
          }

          message.key = reader.string();
          continue;
        }
        case 2: {
          if (tag !== 16) {
            break;
          }

          message.value = reader.int64() as bigint;
          continue;
        }
      }
      if ((tag & 7) === 4 || tag === 0) {
        break;
      }
      reader.skip(tag & 7);
    }
    return message;
  },

  fromJSON(object: any): HandshakeResponse_LimitsEntry {
    return {
      key: isSet(object.key) ? globalThis.String(object.key) : "",
      value: isSet(object.value) ? BigInt(object.value) : 0n,
    };
  },

  toJSON(message: HandshakeResponse_LimitsEntry): unknown {
    const obj: any = {};
    if (message.key !== "") {
      obj.key = message.key;
    }
    if (message.value !== 0n) {
      obj.value = message.value.toString();
    }
    return obj;
  },

  create<I extends Exact<DeepPartial<HandshakeResponse_LimitsEntry>, I>>(base?: I): HandshakeResponse_LimitsEntry {
    return HandshakeResponse_LimitsEntry.fromPartial(base ?? ({} as any));
  },
  fromPartial<I extends Exact<DeepPartial<HandshakeResponse_LimitsEntry>, I>>(
    object: I,
  ): HandshakeResponse_LimitsEntry {
    const message = createBaseHandshakeResponse_LimitsEntry();
    message.key = object.key ?? "";
    message.value = object.value ?? 0n;
    return message;
  },
};

function createBaseServerInfo(): ServerInfo {
  return { name: "", version: "", features: [] };
}

export const ServerInfo: MessageFns<ServerInfo> = {
  encode(message: ServerInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
    if (message.name !== "") {
      writer.uint32(10).string(message.name);
    }
    if (message.version !== "") {
      writer.uint32(18).string(message.version);
    }
    for (const v of message.features) {
      writer.uint32(26).string(v!);
    }
    return writer;
  },

  decode(input: BinaryReader | Uint8Array, length?: number): ServerInfo {
    const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
    const end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseServerInfo();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1: {
          if (tag !== 10) {
            break;
          }

          message.name = reader.string();
          continue;
        }
        case 2: {
          if (tag !== 18) {
            break;
          }

          message.version = reader.string();
          continue;
        }
        case 3: {
          if (tag !== 26) {
            break;
          }

          message.features.push(reader.string());
          continue;
        }
      }
      if ((tag & 7) === 4 || tag === 0) {
        break;
      }
      reader.skip(tag & 7);
    }
    return message;
  },

  fromJSON(object: any): ServerInfo {
    return {
      name: isSet(object.name) ? globalThis.String(object.name) : "",
      version: isSet(object.version) ? globalThis.String(object.version) : "",
      features: globalThis.Array.isArray(object?.features) ? object.features.map((e: any) => globalThis.String(e)) : [],
    };
  },

  toJSON(message: ServerInfo): unknown {
    const obj: any = {};
    if (message.name !== "") {
      obj.name = message.name;
    }
    if (message.version !== "") {
      obj.version = message.version;
    }
    if (message.features?.length) {
      obj.features = message.features;
    }
    return obj;
  },

  create<I extends Exact<DeepPartial<ServerInfo>, I>>(base?: I): ServerInfo {
    return ServerInfo.fromPartial(base ?? ({} as any));
  },
  fromPartial<I extends Exact<DeepPartial<ServerInfo>, I>>(object: I): ServerInfo {
    const message = createBaseServerInfo();
    message.name = object.name ?? "";
    message.version = object.version ?? "";
    message.features = object.features?.map((e) => e) || [];
    return message;
  },
};

function createBaseConfigureRequest(): ConfigureRequest {
  return { sessionId: "", schema: undefined, graph: undefined, timeZoneOffsetMinutes: undefined, parameter: undefined };
}

export const ConfigureRequest: MessageFns<ConfigureRequest> = {
  encode(message: ConfigureRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
    if (message.sessionId !== "") {
      writer.uint32(10).string(message.sessionId);
    }
    if (message.schema !== undefined) {
      writer.uint32(18).string(message.schema);
    }
    if (message.graph !== undefined) {
      writer.uint32(26).string(message.graph);
    }
    if (message.timeZoneOffsetMinutes !== undefined) {
      writer.uint32(32).int32(message.timeZoneOffsetMinutes);
    }
    if (message.parameter !== undefined) {
      SessionParameter.encode(message.parameter, writer.uint32(42).fork()).join();
    }
    return writer;
  },

  decode(input: BinaryReader | Uint8Array, length?: number): ConfigureRequest {
    const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
    const end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseConfigureRequest();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1: {
          if (tag !== 10) {
            break;
          }

          message.sessionId = reader.string();
          continue;
        }
        case 2: {
          if (tag !== 18) {
            break;
          }

          message.schema = reader.string();
          continue;
        }
        case 3: {
          if (tag !== 26) {
            break;
          }

          message.graph = reader.string();
          continue;
        }
        case 4: {
          if (tag !== 32) {
            break;
          }

          message.timeZoneOffsetMinutes = reader.int32();
          continue;
        }
        case 5: {
          if (tag !== 42) {
            break;
          }

          message.parameter = SessionParameter.decode(reader, reader.uint32());
          continue;
        }
      }
      if ((tag & 7) === 4 || tag === 0) {
        break;
      }
      reader.skip(tag & 7);
    }
    return message;
  },

  fromJSON(object: any): ConfigureRequest {
    return {
      sessionId: isSet(object.sessionId)
        ? globalThis.String(object.sessionId)
        : isSet(object.session_id)
        ? globalThis.String(object.session_id)
        : "",
      schema: isSet(object.schema) ? globalThis.String(object.schema) : undefined,
      graph: isSet(object.graph) ? globalThis.String(object.graph) : undefined,
      timeZoneOffsetMinutes: isSet(object.timeZoneOffsetMinutes)
        ? globalThis.Number(object.timeZoneOffsetMinutes)
        : isSet(object.time_zone_offset_minutes)
        ? globalThis.Number(object.time_zone_offset_minutes)
        : undefined,
      parameter: isSet(object.parameter) ? SessionParameter.fromJSON(object.parameter) : undefined,
    };
  },

  toJSON(message: ConfigureRequest): unknown {
    const obj: any = {};
    if (message.sessionId !== "") {
      obj.sessionId = message.sessionId;
    }
    if (message.schema !== undefined) {
      obj.schema = message.schema;
    }
    if (message.graph !== undefined) {
      obj.graph = message.graph;
    }
    if (message.timeZoneOffsetMinutes !== undefined) {
      obj.timeZoneOffsetMinutes = Math.round(message.timeZoneOffsetMinutes);
    }
    if (message.parameter !== undefined) {
      obj.parameter = SessionParameter.toJSON(message.parameter);
    }
    return obj;
  },

  create<I extends Exact<DeepPartial<ConfigureRequest>, I>>(base?: I): ConfigureRequest {
    return ConfigureRequest.fromPartial(base ?? ({} as any));
  },
  fromPartial<I extends Exact<DeepPartial<ConfigureRequest>, I>>(object: I): ConfigureRequest {
    const message = createBaseConfigureRequest();
    message.sessionId = object.sessionId ?? "";
    message.schema = object.schema ?? undefined;
    message.graph = object.graph ?? undefined;
    message.timeZoneOffsetMinutes = object.timeZoneOffsetMinutes ?? undefined;
    message.parameter = (object.parameter !== undefined && object.parameter !== null)
      ? SessionParameter.fromPartial(object.parameter)
      : undefined;
    return message;
  },
};

function createBaseSessionParameter(): SessionParameter {
  return { name: "", value: undefined };
}

export const SessionParameter: MessageFns<SessionParameter> = {
  encode(message: SessionParameter, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
    if (message.name !== "") {
      writer.uint32(10).string(message.name);
    }
    if (message.value !== undefined) {
      Value.encode(message.value, writer.uint32(18).fork()).join();
    }
    return writer;
  },

  decode(input: BinaryReader | Uint8Array, length?: number): SessionParameter {
    const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
    const end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseSessionParameter();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1: {
          if (tag !== 10) {
            break;
          }

          message.name = reader.string();
          continue;
        }
        case 2: {
          if (tag !== 18) {
            break;
          }

          message.value = Value.decode(reader, reader.uint32());
          continue;
        }
      }
      if ((tag & 7) === 4 || tag === 0) {
        break;
      }
      reader.skip(tag & 7);
    }
    return message;
  },

  fromJSON(object: any): SessionParameter {
    return {
      name: isSet(object.name) ? globalThis.String(object.name) : "",
      value: isSet(object.value) ? Value.fromJSON(object.value) : undefined,
    };
  },

  toJSON(message: SessionParameter): unknown {
    const obj: any = {};
    if (message.name !== "") {
      obj.name = message.name;
    }
    if (message.value !== undefined) {
      obj.value = Value.toJSON(message.value);
    }
    return obj;
  },

  create<I extends Exact<DeepPartial<SessionParameter>, I>>(base?: I): SessionParameter {
    return SessionParameter.fromPartial(base ?? ({} as any));
  },
  fromPartial<I extends Exact<DeepPartial<SessionParameter>, I>>(object: I): SessionParameter {
    const message = createBaseSessionParameter();
    message.name = object.name ?? "";
    message.value = (object.value !== undefined && object.value !== null) ? Value.fromPartial(object.value) : undefined;
    return message;
  },
};

function createBaseConfigureResponse(): ConfigureResponse {
  return {};
}

export const ConfigureResponse: MessageFns<ConfigureResponse> = {
  encode(_: ConfigureResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
    return writer;
  },

  decode(input: BinaryReader | Uint8Array, length?: number): ConfigureResponse {
    const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
    const end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseConfigureResponse();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
      }
      if ((tag & 7) === 4 || tag === 0) {
        break;
      }
      reader.skip(tag & 7);
    }
    return message;
  },

  fromJSON(_: any): ConfigureResponse {
    return {};
  },

  toJSON(_: ConfigureResponse): unknown {
    const obj: any = {};
    return obj;
  },

  create<I extends Exact<DeepPartial<ConfigureResponse>, I>>(base?: I): ConfigureResponse {
    return ConfigureResponse.fromPartial(base ?? ({} as any));
  },
  fromPartial<I extends Exact<DeepPartial<ConfigureResponse>, I>>(_: I): ConfigureResponse {
    const message = createBaseConfigureResponse();
    return message;
  },
};

function createBaseResetRequest(): ResetRequest {
  return { sessionId: "", target: 0 };
}

export const ResetRequest: MessageFns<ResetRequest> = {
  encode(message: ResetRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
    if (message.sessionId !== "") {
      writer.uint32(10).string(message.sessionId);
    }
    if (message.target !== 0) {
      writer.uint32(16).int32(message.target);
    }
    return writer;
  },

  decode(input: BinaryReader | Uint8Array, length?: number): ResetRequest {
    const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
    const end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseResetRequest();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1: {
          if (tag !== 10) {
            break;
          }

          message.sessionId = reader.string();
          continue;
        }
        case 2: {
          if (tag !== 16) {
            break;
          }

          message.target = reader.int32() as any;
          continue;
        }
      }
      if ((tag & 7) === 4 || tag === 0) {
        break;
      }
      reader.skip(tag & 7);
    }
    return message;
  },

  fromJSON(object: any): ResetRequest {
    return {
      sessionId: isSet(object.sessionId)
        ? globalThis.String(object.sessionId)
        : isSet(object.session_id)
        ? globalThis.String(object.session_id)
        : "",
      target: isSet(object.target) ? resetTargetFromJSON(object.target) : 0,
    };
  },

  toJSON(message: ResetRequest): unknown {
    const obj: any = {};
    if (message.sessionId !== "") {
      obj.sessionId = message.sessionId;
    }
    if (message.target !== 0) {
      obj.target = resetTargetToJSON(message.target);
    }
    return obj;
  },

  create<I extends Exact<DeepPartial<ResetRequest>, I>>(base?: I): ResetRequest {
    return ResetRequest.fromPartial(base ?? ({} as any));
  },
  fromPartial<I extends Exact<DeepPartial<ResetRequest>, I>>(object: I): ResetRequest {
    const message = createBaseResetRequest();
    message.sessionId = object.sessionId ?? "";
    message.target = object.target ?? 0;
    return message;
  },
};

function createBaseResetResponse(): ResetResponse {
  return {};
}

export const ResetResponse: MessageFns<ResetResponse> = {
  encode(_: ResetResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
    return writer;
  },

  decode(input: BinaryReader | Uint8Array, length?: number): ResetResponse {
    const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
    const end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseResetResponse();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
      }
      if ((tag & 7) === 4 || tag === 0) {
        break;
      }
      reader.skip(tag & 7);
    }
    return message;
  },

  fromJSON(_: any): ResetResponse {
    return {};
  },

  toJSON(_: ResetResponse): unknown {
    const obj: any = {};
    return obj;
  },

  create<I extends Exact<DeepPartial<ResetResponse>, I>>(base?: I): ResetResponse {
    return ResetResponse.fromPartial(base ?? ({} as any));
  },
  fromPartial<I extends Exact<DeepPartial<ResetResponse>, I>>(_: I): ResetResponse {
    const message = createBaseResetResponse();
    return message;
  },
};

function createBaseCloseRequest(): CloseRequest {
  return { sessionId: "" };
}

export const CloseRequest: MessageFns<CloseRequest> = {
  encode(message: CloseRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
    if (message.sessionId !== "") {
      writer.uint32(10).string(message.sessionId);
    }
    return writer;
  },

  decode(input: BinaryReader | Uint8Array, length?: number): CloseRequest {
    const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
    const end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseCloseRequest();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1: {
          if (tag !== 10) {
            break;
          }

          message.sessionId = reader.string();
          continue;
        }
      }
      if ((tag & 7) === 4 || tag === 0) {
        break;
      }
      reader.skip(tag & 7);
    }
    return message;
  },

  fromJSON(object: any): CloseRequest {
    return {
      sessionId: isSet(object.sessionId)
        ? globalThis.String(object.sessionId)
        : isSet(object.session_id)
        ? globalThis.String(object.session_id)
        : "",
    };
  },

  toJSON(message: CloseRequest): unknown {
    const obj: any = {};
    if (message.sessionId !== "") {
      obj.sessionId = message.sessionId;
    }
    return obj;
  },

  create<I extends Exact<DeepPartial<CloseRequest>, I>>(base?: I): CloseRequest {
    return CloseRequest.fromPartial(base ?? ({} as any));
  },
  fromPartial<I extends Exact<DeepPartial<CloseRequest>, I>>(object: I): CloseRequest {
    const message = createBaseCloseRequest();
    message.sessionId = object.sessionId ?? "";
    return message;
  },
};

function createBaseCloseResponse(): CloseResponse {
  return {};
}

export const CloseResponse: MessageFns<CloseResponse> = {
  encode(_: CloseResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
    return writer;
  },

  decode(input: BinaryReader | Uint8Array, length?: number): CloseResponse {
    const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
    const end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseCloseResponse();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
      }
      if ((tag & 7) === 4 || tag === 0) {
        break;
      }
      reader.skip(tag & 7);
    }
    return message;
  },

  fromJSON(_: any): CloseResponse {
    return {};
  },

  toJSON(_: CloseResponse): unknown {
    const obj: any = {};
    return obj;
  },

  create<I extends Exact<DeepPartial<CloseResponse>, I>>(base?: I): CloseResponse {
    return CloseResponse.fromPartial(base ?? ({} as any));
  },
  fromPartial<I extends Exact<DeepPartial<CloseResponse>, I>>(_: I): CloseResponse {
    const message = createBaseCloseResponse();
    return message;
  },
};

function createBasePingRequest(): PingRequest {
  return { sessionId: "" };
}

export const PingRequest: MessageFns<PingRequest> = {
  encode(message: PingRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
    if (message.sessionId !== "") {
      writer.uint32(10).string(message.sessionId);
    }
    return writer;
  },

  decode(input: BinaryReader | Uint8Array, length?: number): PingRequest {
    const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
    const end = length === undefined ? reader.len : reader.pos + length;
    const message = createBasePingRequest();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1: {
          if (tag !== 10) {
            break;
          }

          message.sessionId = reader.string();
          continue;
        }
      }
      if ((tag & 7) === 4 || tag === 0) {
        break;
      }
      reader.skip(tag & 7);
    }
    return message;
  },

  fromJSON(object: any): PingRequest {
    return {
      sessionId: isSet(object.sessionId)
        ? globalThis.String(object.sessionId)
        : isSet(object.session_id)
        ? globalThis.String(object.session_id)
        : "",
    };
  },

  toJSON(message: PingRequest): unknown {
    const obj: any = {};
    if (message.sessionId !== "") {
      obj.sessionId = message.sessionId;
    }
    return obj;
  },

  create<I extends Exact<DeepPartial<PingRequest>, I>>(base?: I): PingRequest {
    return PingRequest.fromPartial(base ?? ({} as any));
  },
  fromPartial<I extends Exact<DeepPartial<PingRequest>, I>>(object: I): PingRequest {
    const message = createBasePingRequest();
    message.sessionId = object.sessionId ?? "";
    return message;
  },
};

function createBasePongResponse(): PongResponse {
  return { timestamp: 0n };
}

export const PongResponse: MessageFns<PongResponse> = {
  encode(message: PongResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
    if (message.timestamp !== 0n) {
      if (BigInt.asIntN(64, message.timestamp) !== message.timestamp) {
        throw new globalThis.Error("value provided for field message.timestamp of type int64 too large");
      }
      writer.uint32(8).int64(message.timestamp);
    }
    return writer;
  },

  decode(input: BinaryReader | Uint8Array, length?: number): PongResponse {
    const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
    const end = length === undefined ? reader.len : reader.pos + length;
    const message = createBasePongResponse();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1: {
          if (tag !== 8) {
            break;
          }

          message.timestamp = reader.int64() as bigint;
          continue;
        }
      }
      if ((tag & 7) === 4 || tag === 0) {
        break;
      }
      reader.skip(tag & 7);
    }
    return message;
  },

  fromJSON(object: any): PongResponse {
    return { timestamp: isSet(object.timestamp) ? BigInt(object.timestamp) : 0n };
  },

  toJSON(message: PongResponse): unknown {
    const obj: any = {};
    if (message.timestamp !== 0n) {
      obj.timestamp = message.timestamp.toString();
    }
    return obj;
  },

  create<I extends Exact<DeepPartial<PongResponse>, I>>(base?: I): PongResponse {
    return PongResponse.fromPartial(base ?? ({} as any));
  },
  fromPartial<I extends Exact<DeepPartial<PongResponse>, I>>(object: I): PongResponse {
    const message = createBasePongResponse();
    message.timestamp = object.timestamp ?? 0n;
    return message;
  },
};

function createBaseExecuteRequest(): ExecuteRequest {
  return { sessionId: "", statement: "", parameters: {}, transactionId: undefined };
}

export const ExecuteRequest: MessageFns<ExecuteRequest> = {
  encode(message: ExecuteRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
    if (message.sessionId !== "") {
      writer.uint32(10).string(message.sessionId);
    }
    if (message.statement !== "") {
      writer.uint32(18).string(message.statement);
    }
    globalThis.Object.entries(message.parameters).forEach(([key, value]: [string, Value]) => {
      ExecuteRequest_ParametersEntry.encode({ key: key as any, value }, writer.uint32(26).fork()).join();
    });
    if (message.transactionId !== undefined) {
      writer.uint32(34).string(message.transactionId);
    }
    return writer;
  },

  decode(input: BinaryReader | Uint8Array, length?: number): ExecuteRequest {
    const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
    const end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseExecuteRequest();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1: {
          if (tag !== 10) {
            break;
          }

          message.sessionId = reader.string();
          continue;
        }
        case 2: {
          if (tag !== 18) {
            break;
          }

          message.statement = reader.string();
          continue;
        }
        case 3: {
          if (tag !== 26) {
            break;
          }

          const entry3 = ExecuteRequest_ParametersEntry.decode(reader, reader.uint32());
          if (entry3.value !== undefined) {
            message.parameters[entry3.key] = entry3.value;
          }
          continue;
        }
        case 4: {
          if (tag !== 34) {
            break;
          }

          message.transactionId = reader.string();
          continue;
        }
      }
      if ((tag & 7) === 4 || tag === 0) {
        break;
      }
      reader.skip(tag & 7);
    }
    return message;
  },

  fromJSON(object: any): ExecuteRequest {
    return {
      sessionId: isSet(object.sessionId)
        ? globalThis.String(object.sessionId)
        : isSet(object.session_id)
        ? globalThis.String(object.session_id)
        : "",
      statement: isSet(object.statement) ? globalThis.String(object.statement) : "",
      parameters: isObject(object.parameters)
        ? (globalThis.Object.entries(object.parameters) as [string, any][]).reduce(
          (acc: { [key: string]: Value }, [key, value]: [string, any]) => {
            acc[key] = Value.fromJSON(value);
            return acc;
          },
          {},
        )
        : {},
      transactionId: isSet(object.transactionId)
        ? globalThis.String(object.transactionId)
        : isSet(object.transaction_id)
        ? globalThis.String(object.transaction_id)
        : undefined,
    };
  },

  toJSON(message: ExecuteRequest): unknown {
    const obj: any = {};
    if (message.sessionId !== "") {
      obj.sessionId = message.sessionId;
    }
    if (message.statement !== "") {
      obj.statement = message.statement;
    }
    if (message.parameters) {
      const entries = globalThis.Object.entries(message.parameters) as [string, Value][];
      if (entries.length > 0) {
        obj.parameters = {};
        entries.forEach(([k, v]) => {
          obj.parameters[k] = Value.toJSON(v);
        });
      }
    }
    if (message.transactionId !== undefined) {
      obj.transactionId = message.transactionId;
    }
    return obj;
  },

  create<I extends Exact<DeepPartial<ExecuteRequest>, I>>(base?: I): ExecuteRequest {
    return ExecuteRequest.fromPartial(base ?? ({} as any));
  },
  fromPartial<I extends Exact<DeepPartial<ExecuteRequest>, I>>(object: I): ExecuteRequest {
    const message = createBaseExecuteRequest();
    message.sessionId = object.sessionId ?? "";
    message.statement = object.statement ?? "";
    message.parameters = (globalThis.Object.entries(object.parameters ?? {}) as [string, Value][]).reduce(
      (acc: { [key: string]: Value }, [key, value]: [string, Value]) => {
        if (value !== undefined) {
          acc[key] = Value.fromPartial(value);
        }
        return acc;
      },
      {},
    );
    message.transactionId = object.transactionId ?? undefined;
    return message;
  },
};

function createBaseExecuteRequest_ParametersEntry(): ExecuteRequest_ParametersEntry {
  return { key: "", value: undefined };
}

export const ExecuteRequest_ParametersEntry: MessageFns<ExecuteRequest_ParametersEntry> = {
  encode(message: ExecuteRequest_ParametersEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
    if (message.key !== "") {
      writer.uint32(10).string(message.key);
    }
    if (message.value !== undefined) {
      Value.encode(message.value, writer.uint32(18).fork()).join();
    }
    return writer;
  },

  decode(input: BinaryReader | Uint8Array, length?: number): ExecuteRequest_ParametersEntry {
    const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
    const end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseExecuteRequest_ParametersEntry();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1: {
          if (tag !== 10) {
            break;
          }

          message.key = reader.string();
          continue;
        }
        case 2: {
          if (tag !== 18) {
            break;
          }

          message.value = Value.decode(reader, reader.uint32());
          continue;
        }
      }
      if ((tag & 7) === 4 || tag === 0) {
        break;
      }
      reader.skip(tag & 7);
    }
    return message;
  },

  fromJSON(object: any): ExecuteRequest_ParametersEntry {
    return {
      key: isSet(object.key) ? globalThis.String(object.key) : "",
      value: isSet(object.value) ? Value.fromJSON(object.value) : undefined,
    };
  },

  toJSON(message: ExecuteRequest_ParametersEntry): unknown {
    const obj: any = {};
    if (message.key !== "") {
      obj.key = message.key;
    }
    if (message.value !== undefined) {
      obj.value = Value.toJSON(message.value);
    }
    return obj;
  },

  create<I extends Exact<DeepPartial<ExecuteRequest_ParametersEntry>, I>>(base?: I): ExecuteRequest_ParametersEntry {
    return ExecuteRequest_ParametersEntry.fromPartial(base ?? ({} as any));
  },
  fromPartial<I extends Exact<DeepPartial<ExecuteRequest_ParametersEntry>, I>>(
    object: I,
  ): ExecuteRequest_ParametersEntry {
    const message = createBaseExecuteRequest_ParametersEntry();
    message.key = object.key ?? "";
    message.value = (object.value !== undefined && object.value !== null) ? Value.fromPartial(object.value) : undefined;
    return message;
  },
};

function createBaseExecuteResponse(): ExecuteResponse {
  return { header: undefined, rowBatch: undefined, summary: undefined };
}

export const ExecuteResponse: MessageFns<ExecuteResponse> = {
  encode(message: ExecuteResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
    if (message.header !== undefined) {
      ResultHeader.encode(message.header, writer.uint32(10).fork()).join();
    }
    if (message.rowBatch !== undefined) {
      RowBatch.encode(message.rowBatch, writer.uint32(18).fork()).join();
    }
    if (message.summary !== undefined) {
      ResultSummary.encode(message.summary, writer.uint32(26).fork()).join();
    }
    return writer;
  },

  decode(input: BinaryReader | Uint8Array, length?: number): ExecuteResponse {
    const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
    const end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseExecuteResponse();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1: {
          if (tag !== 10) {
            break;
          }

          message.header = ResultHeader.decode(reader, reader.uint32());
          continue;
        }
        case 2: {
          if (tag !== 18) {
            break;
          }

          message.rowBatch = RowBatch.decode(reader, reader.uint32());
          continue;
        }
        case 3: {
          if (tag !== 26) {
            break;
          }

          message.summary = ResultSummary.decode(reader, reader.uint32());
          continue;
        }
      }
      if ((tag & 7) === 4 || tag === 0) {
        break;
      }
      reader.skip(tag & 7);
    }
    return message;
  },

  fromJSON(object: any): ExecuteResponse {
    return {
      header: isSet(object.header) ? ResultHeader.fromJSON(object.header) : undefined,
      rowBatch: isSet(object.rowBatch)
        ? RowBatch.fromJSON(object.rowBatch)
        : isSet(object.row_batch)
        ? RowBatch.fromJSON(object.row_batch)
        : undefined,
      summary: isSet(object.summary) ? ResultSummary.fromJSON(object.summary) : undefined,
    };
  },

  toJSON(message: ExecuteResponse): unknown {
    const obj: any = {};
    if (message.header !== undefined) {
      obj.header = ResultHeader.toJSON(message.header);
    }
    if (message.rowBatch !== undefined) {
      obj.rowBatch = RowBatch.toJSON(message.rowBatch);
    }
    if (message.summary !== undefined) {
      obj.summary = ResultSummary.toJSON(message.summary);
    }
    return obj;
  },

  create<I extends Exact<DeepPartial<ExecuteResponse>, I>>(base?: I): ExecuteResponse {
    return ExecuteResponse.fromPartial(base ?? ({} as any));
  },
  fromPartial<I extends Exact<DeepPartial<ExecuteResponse>, I>>(object: I): ExecuteResponse {
    const message = createBaseExecuteResponse();
    message.header = (object.header !== undefined && object.header !== null)
      ? ResultHeader.fromPartial(object.header)
      : undefined;
    message.rowBatch = (object.rowBatch !== undefined && object.rowBatch !== null)
      ? RowBatch.fromPartial(object.rowBatch)
      : undefined;
    message.summary = (object.summary !== undefined && object.summary !== null)
      ? ResultSummary.fromPartial(object.summary)
      : undefined;
    return message;
  },
};

function createBaseResultHeader(): ResultHeader {
  return { resultType: 0, columns: [], ordered: false };
}

export const ResultHeader: MessageFns<ResultHeader> = {
  encode(message: ResultHeader, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
    if (message.resultType !== 0) {
      writer.uint32(8).int32(message.resultType);
    }
    for (const v of message.columns) {
      ColumnDescriptor.encode(v!, writer.uint32(18).fork()).join();
    }
    if (message.ordered !== false) {
      writer.uint32(24).bool(message.ordered);
    }
    return writer;
  },

  decode(input: BinaryReader | Uint8Array, length?: number): ResultHeader {
    const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
    const end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseResultHeader();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1: {
          if (tag !== 8) {
            break;
          }

          message.resultType = reader.int32() as any;
          continue;
        }
        case 2: {
          if (tag !== 18) {
            break;
          }

          message.columns.push(ColumnDescriptor.decode(reader, reader.uint32()));
          continue;
        }
        case 3: {
          if (tag !== 24) {
            break;
          }

          message.ordered = reader.bool();
          continue;
        }
      }
      if ((tag & 7) === 4 || tag === 0) {
        break;
      }
      reader.skip(tag & 7);
    }
    return message;
  },

  fromJSON(object: any): ResultHeader {
    return {
      resultType: isSet(object.resultType)
        ? resultTypeFromJSON(object.resultType)
        : isSet(object.result_type)
        ? resultTypeFromJSON(object.result_type)
        : 0,
      columns: globalThis.Array.isArray(object?.columns)
        ? object.columns.map((e: any) => ColumnDescriptor.fromJSON(e))
        : [],
      ordered: isSet(object.ordered) ? globalThis.Boolean(object.ordered) : false,
    };
  },

  toJSON(message: ResultHeader): unknown {
    const obj: any = {};
    if (message.resultType !== 0) {
      obj.resultType = resultTypeToJSON(message.resultType);
    }
    if (message.columns?.length) {
      obj.columns = message.columns.map((e) => ColumnDescriptor.toJSON(e));
    }
    if (message.ordered !== false) {
      obj.ordered = message.ordered;
    }
    return obj;
  },

  create<I extends Exact<DeepPartial<ResultHeader>, I>>(base?: I): ResultHeader {
    return ResultHeader.fromPartial(base ?? ({} as any));
  },
  fromPartial<I extends Exact<DeepPartial<ResultHeader>, I>>(object: I): ResultHeader {
    const message = createBaseResultHeader();
    message.resultType = object.resultType ?? 0;
    message.columns = object.columns?.map((e) => ColumnDescriptor.fromPartial(e)) || [];
    message.ordered = object.ordered ?? false;
    return message;
  },
};

function createBaseColumnDescriptor(): ColumnDescriptor {
  return { name: "", type: undefined };
}

export const ColumnDescriptor: MessageFns<ColumnDescriptor> = {
  encode(message: ColumnDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
    if (message.name !== "") {
      writer.uint32(10).string(message.name);
    }
    if (message.type !== undefined) {
      TypeDescriptor.encode(message.type, writer.uint32(18).fork()).join();
    }
    return writer;
  },

  decode(input: BinaryReader | Uint8Array, length?: number): ColumnDescriptor {
    const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
    const end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseColumnDescriptor();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1: {
          if (tag !== 10) {
            break;
          }

          message.name = reader.string();
          continue;
        }
        case 2: {
          if (tag !== 18) {
            break;
          }

          message.type = TypeDescriptor.decode(reader, reader.uint32());
          continue;
        }
      }
      if ((tag & 7) === 4 || tag === 0) {
        break;
      }
      reader.skip(tag & 7);
    }
    return message;
  },

  fromJSON(object: any): ColumnDescriptor {
    return {
      name: isSet(object.name) ? globalThis.String(object.name) : "",
      type: isSet(object.type) ? TypeDescriptor.fromJSON(object.type) : undefined,
    };
  },

  toJSON(message: ColumnDescriptor): unknown {
    const obj: any = {};
    if (message.name !== "") {
      obj.name = message.name;
    }
    if (message.type !== undefined) {
      obj.type = TypeDescriptor.toJSON(message.type);
    }
    return obj;
  },

  create<I extends Exact<DeepPartial<ColumnDescriptor>, I>>(base?: I): ColumnDescriptor {
    return ColumnDescriptor.fromPartial(base ?? ({} as any));
  },
  fromPartial<I extends Exact<DeepPartial<ColumnDescriptor>, I>>(object: I): ColumnDescriptor {
    const message = createBaseColumnDescriptor();
    message.name = object.name ?? "";
    message.type = (object.type !== undefined && object.type !== null)
      ? TypeDescriptor.fromPartial(object.type)
      : undefined;
    return message;
  },
};

function createBaseRowBatch(): RowBatch {
  return { rows: [] };
}

export const RowBatch: MessageFns<RowBatch> = {
  encode(message: RowBatch, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
    for (const v of message.rows) {
      Row.encode(v!, writer.uint32(10).fork()).join();
    }
    return writer;
  },

  decode(input: BinaryReader | Uint8Array, length?: number): RowBatch {
    const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
    const end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseRowBatch();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1: {
          if (tag !== 10) {
            break;
          }

          message.rows.push(Row.decode(reader, reader.uint32()));
          continue;
        }
      }
      if ((tag & 7) === 4 || tag === 0) {
        break;
      }
      reader.skip(tag & 7);
    }
    return message;
  },

  fromJSON(object: any): RowBatch {
    return { rows: globalThis.Array.isArray(object?.rows) ? object.rows.map((e: any) => Row.fromJSON(e)) : [] };
  },

  toJSON(message: RowBatch): unknown {
    const obj: any = {};
    if (message.rows?.length) {
      obj.rows = message.rows.map((e) => Row.toJSON(e));
    }
    return obj;
  },

  create<I extends Exact<DeepPartial<RowBatch>, I>>(base?: I): RowBatch {
    return RowBatch.fromPartial(base ?? ({} as any));
  },
  fromPartial<I extends Exact<DeepPartial<RowBatch>, I>>(object: I): RowBatch {
    const message = createBaseRowBatch();
    message.rows = object.rows?.map((e) => Row.fromPartial(e)) || [];
    return message;
  },
};

function createBaseRow(): Row {
  return { values: [] };
}

export const Row: MessageFns<Row> = {
  encode(message: Row, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
    for (const v of message.values) {
      Value.encode(v!, writer.uint32(10).fork()).join();
    }
    return writer;
  },

  decode(input: BinaryReader | Uint8Array, length?: number): Row {
    const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
    const end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseRow();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1: {
          if (tag !== 10) {
            break;
          }

          message.values.push(Value.decode(reader, reader.uint32()));
          continue;
        }
      }
      if ((tag & 7) === 4 || tag === 0) {
        break;
      }
      reader.skip(tag & 7);
    }
    return message;
  },

  fromJSON(object: any): Row {
    return { values: globalThis.Array.isArray(object?.values) ? object.values.map((e: any) => Value.fromJSON(e)) : [] };
  },

  toJSON(message: Row): unknown {
    const obj: any = {};
    if (message.values?.length) {
      obj.values = message.values.map((e) => Value.toJSON(e));
    }
    return obj;
  },

  create<I extends Exact<DeepPartial<Row>, I>>(base?: I): Row {
    return Row.fromPartial(base ?? ({} as any));
  },
  fromPartial<I extends Exact<DeepPartial<Row>, I>>(object: I): Row {
    const message = createBaseRow();
    message.values = object.values?.map((e) => Value.fromPartial(e)) || [];
    return message;
  },
};

function createBaseResultSummary(): ResultSummary {
  return { status: undefined, warnings: [], rowsAffected: 0n, counters: {} };
}

export const ResultSummary: MessageFns<ResultSummary> = {
  encode(message: ResultSummary, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
    if (message.status !== undefined) {
      GqlStatus.encode(message.status, writer.uint32(10).fork()).join();
    }
    for (const v of message.warnings) {
      GqlStatus.encode(v!, writer.uint32(18).fork()).join();
    }
    if (message.rowsAffected !== 0n) {
      if (BigInt.asIntN(64, message.rowsAffected) !== message.rowsAffected) {
        throw new globalThis.Error("value provided for field message.rowsAffected of type int64 too large");
      }
      writer.uint32(24).int64(message.rowsAffected);
    }
    globalThis.Object.entries(message.counters).forEach(([key, value]: [string, bigint]) => {
      ResultSummary_CountersEntry.encode({ key: key as any, value }, writer.uint32(34).fork()).join();
    });
    return writer;
  },

  decode(input: BinaryReader | Uint8Array, length?: number): ResultSummary {
    const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
    const end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseResultSummary();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1: {
          if (tag !== 10) {
            break;
          }

          message.status = GqlStatus.decode(reader, reader.uint32());
          continue;
        }
        case 2: {
          if (tag !== 18) {
            break;
          }

          message.warnings.push(GqlStatus.decode(reader, reader.uint32()));
          continue;
        }
        case 3: {
          if (tag !== 24) {
            break;
          }

          message.rowsAffected = reader.int64() as bigint;
          continue;
        }
        case 4: {
          if (tag !== 34) {
            break;
          }

          const entry4 = ResultSummary_CountersEntry.decode(reader, reader.uint32());
          if (entry4.value !== undefined) {
            message.counters[entry4.key] = entry4.value;
          }
          continue;
        }
      }
      if ((tag & 7) === 4 || tag === 0) {
        break;
      }
      reader.skip(tag & 7);
    }
    return message;
  },

  fromJSON(object: any): ResultSummary {
    return {
      status: isSet(object.status) ? GqlStatus.fromJSON(object.status) : undefined,
      warnings: globalThis.Array.isArray(object?.warnings)
        ? object.warnings.map((e: any) => GqlStatus.fromJSON(e))
        : [],
      rowsAffected: isSet(object.rowsAffected)
        ? BigInt(object.rowsAffected)
        : isSet(object.rows_affected)
        ? BigInt(object.rows_affected)
        : 0n,
      counters: isObject(object.counters)
        ? (globalThis.Object.entries(object.counters) as [string, any][]).reduce(
          (acc: { [key: string]: bigint }, [key, value]: [string, any]) => {
            acc[key] = BigInt(value as string | number | bigint | boolean);
            return acc;
          },
          {},
        )
        : {},
    };
  },

  toJSON(message: ResultSummary): unknown {
    const obj: any = {};
    if (message.status !== undefined) {
      obj.status = GqlStatus.toJSON(message.status);
    }
    if (message.warnings?.length) {
      obj.warnings = message.warnings.map((e) => GqlStatus.toJSON(e));
    }
    if (message.rowsAffected !== 0n) {
      obj.rowsAffected = message.rowsAffected.toString();
    }
    if (message.counters) {
      const entries = globalThis.Object.entries(message.counters) as [string, bigint][];
      if (entries.length > 0) {
        obj.counters = {};
        entries.forEach(([k, v]) => {
          obj.counters[k] = v.toString();
        });
      }
    }
    return obj;
  },

  create<I extends Exact<DeepPartial<ResultSummary>, I>>(base?: I): ResultSummary {
    return ResultSummary.fromPartial(base ?? ({} as any));
  },
  fromPartial<I extends Exact<DeepPartial<ResultSummary>, I>>(object: I): ResultSummary {
    const message = createBaseResultSummary();
    message.status = (object.status !== undefined && object.status !== null)
      ? GqlStatus.fromPartial(object.status)
      : undefined;
    message.warnings = object.warnings?.map((e) => GqlStatus.fromPartial(e)) || [];
    message.rowsAffected = object.rowsAffected ?? 0n;
    message.counters = (globalThis.Object.entries(object.counters ?? {}) as [string, bigint][]).reduce(
      (acc: { [key: string]: bigint }, [key, value]: [string, bigint]) => {
        if (value !== undefined) {
          acc[key] = BigInt(value as string | number | bigint | boolean);
        }
        return acc;
      },
      {},
    );
    return message;
  },
};

function createBaseResultSummary_CountersEntry(): ResultSummary_CountersEntry {
  return { key: "", value: 0n };
}

export const ResultSummary_CountersEntry: MessageFns<ResultSummary_CountersEntry> = {
  encode(message: ResultSummary_CountersEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
    if (message.key !== "") {
      writer.uint32(10).string(message.key);
    }
    if (message.value !== 0n) {
      if (BigInt.asIntN(64, message.value) !== message.value) {
        throw new globalThis.Error("value provided for field message.value of type int64 too large");
      }
      writer.uint32(16).int64(message.value);
    }
    return writer;
  },

  decode(input: BinaryReader | Uint8Array, length?: number): ResultSummary_CountersEntry {
    const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
    const end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseResultSummary_CountersEntry();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1: {
          if (tag !== 10) {
            break;
          }

          message.key = reader.string();
          continue;
        }
        case 2: {
          if (tag !== 16) {
            break;
          }

          message.value = reader.int64() as bigint;
          continue;
        }
      }
      if ((tag & 7) === 4 || tag === 0) {
        break;
      }
      reader.skip(tag & 7);
    }
    return message;
  },

  fromJSON(object: any): ResultSummary_CountersEntry {
    return {
      key: isSet(object.key) ? globalThis.String(object.key) : "",
      value: isSet(object.value) ? BigInt(object.value) : 0n,
    };
  },

  toJSON(message: ResultSummary_CountersEntry): unknown {
    const obj: any = {};
    if (message.key !== "") {
      obj.key = message.key;
    }
    if (message.value !== 0n) {
      obj.value = message.value.toString();
    }
    return obj;
  },

  create<I extends Exact<DeepPartial<ResultSummary_CountersEntry>, I>>(base?: I): ResultSummary_CountersEntry {
    return ResultSummary_CountersEntry.fromPartial(base ?? ({} as any));
  },
  fromPartial<I extends Exact<DeepPartial<ResultSummary_CountersEntry>, I>>(object: I): ResultSummary_CountersEntry {
    const message = createBaseResultSummary_CountersEntry();
    message.key = object.key ?? "";
    message.value = object.value ?? 0n;
    return message;
  },
};

function createBaseBeginRequest(): BeginRequest {
  return { sessionId: "", mode: 0 };
}

export const BeginRequest: MessageFns<BeginRequest> = {
  encode(message: BeginRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
    if (message.sessionId !== "") {
      writer.uint32(10).string(message.sessionId);
    }
    if (message.mode !== 0) {
      writer.uint32(16).int32(message.mode);
    }
    return writer;
  },

  decode(input: BinaryReader | Uint8Array, length?: number): BeginRequest {
    const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
    const end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseBeginRequest();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1: {
          if (tag !== 10) {
            break;
          }

          message.sessionId = reader.string();
          continue;
        }
        case 2: {
          if (tag !== 16) {
            break;
          }

          message.mode = reader.int32() as any;
          continue;
        }
      }
      if ((tag & 7) === 4 || tag === 0) {
        break;
      }
      reader.skip(tag & 7);
    }
    return message;
  },

  fromJSON(object: any): BeginRequest {
    return {
      sessionId: isSet(object.sessionId)
        ? globalThis.String(object.sessionId)
        : isSet(object.session_id)
        ? globalThis.String(object.session_id)
        : "",
      mode: isSet(object.mode) ? transactionModeFromJSON(object.mode) : 0,
    };
  },

  toJSON(message: BeginRequest): unknown {
    const obj: any = {};
    if (message.sessionId !== "") {
      obj.sessionId = message.sessionId;
    }
    if (message.mode !== 0) {
      obj.mode = transactionModeToJSON(message.mode);
    }
    return obj;
  },

  create<I extends Exact<DeepPartial<BeginRequest>, I>>(base?: I): BeginRequest {
    return BeginRequest.fromPartial(base ?? ({} as any));
  },
  fromPartial<I extends Exact<DeepPartial<BeginRequest>, I>>(object: I): BeginRequest {
    const message = createBaseBeginRequest();
    message.sessionId = object.sessionId ?? "";
    message.mode = object.mode ?? 0;
    return message;
  },
};

function createBaseBeginResponse(): BeginResponse {
  return { transactionId: "", status: undefined };
}

export const BeginResponse: MessageFns<BeginResponse> = {
  encode(message: BeginResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
    if (message.transactionId !== "") {
      writer.uint32(10).string(message.transactionId);
    }
    if (message.status !== undefined) {
      GqlStatus.encode(message.status, writer.uint32(18).fork()).join();
    }
    return writer;
  },

  decode(input: BinaryReader | Uint8Array, length?: number): BeginResponse {
    const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
    const end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseBeginResponse();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1: {
          if (tag !== 10) {
            break;
          }

          message.transactionId = reader.string();
          continue;
        }
        case 2: {
          if (tag !== 18) {
            break;
          }

          message.status = GqlStatus.decode(reader, reader.uint32());
          continue;
        }
      }
      if ((tag & 7) === 4 || tag === 0) {
        break;
      }
      reader.skip(tag & 7);
    }
    return message;
  },

  fromJSON(object: any): BeginResponse {
    return {
      transactionId: isSet(object.transactionId)
        ? globalThis.String(object.transactionId)
        : isSet(object.transaction_id)
        ? globalThis.String(object.transaction_id)
        : "",
      status: isSet(object.status) ? GqlStatus.fromJSON(object.status) : undefined,
    };
  },

  toJSON(message: BeginResponse): unknown {
    const obj: any = {};
    if (message.transactionId !== "") {
      obj.transactionId = message.transactionId;
    }
    if (message.status !== undefined) {
      obj.status = GqlStatus.toJSON(message.status);
    }
    return obj;
  },

  create<I extends Exact<DeepPartial<BeginResponse>, I>>(base?: I): BeginResponse {
    return BeginResponse.fromPartial(base ?? ({} as any));
  },
  fromPartial<I extends Exact<DeepPartial<BeginResponse>, I>>(object: I): BeginResponse {
    const message = createBaseBeginResponse();
    message.transactionId = object.transactionId ?? "";
    message.status = (object.status !== undefined && object.status !== null)
      ? GqlStatus.fromPartial(object.status)
      : undefined;
    return message;
  },
};

function createBaseCommitRequest(): CommitRequest {
  return { sessionId: "", transactionId: "" };
}

export const CommitRequest: MessageFns<CommitRequest> = {
  encode(message: CommitRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
    if (message.sessionId !== "") {
      writer.uint32(10).string(message.sessionId);
    }
    if (message.transactionId !== "") {
      writer.uint32(18).string(message.transactionId);
    }
    return writer;
  },

  decode(input: BinaryReader | Uint8Array, length?: number): CommitRequest {
    const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
    const end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseCommitRequest();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1: {
          if (tag !== 10) {
            break;
          }

          message.sessionId = reader.string();
          continue;
        }
        case 2: {
          if (tag !== 18) {
            break;
          }

          message.transactionId = reader.string();
          continue;
        }
      }
      if ((tag & 7) === 4 || tag === 0) {
        break;
      }
      reader.skip(tag & 7);
    }
    return message;
  },

  fromJSON(object: any): CommitRequest {
    return {
      sessionId: isSet(object.sessionId)
        ? globalThis.String(object.sessionId)
        : isSet(object.session_id)
        ? globalThis.String(object.session_id)
        : "",
      transactionId: isSet(object.transactionId)
        ? globalThis.String(object.transactionId)
        : isSet(object.transaction_id)
        ? globalThis.String(object.transaction_id)
        : "",
    };
  },

  toJSON(message: CommitRequest): unknown {
    const obj: any = {};
    if (message.sessionId !== "") {
      obj.sessionId = message.sessionId;
    }
    if (message.transactionId !== "") {
      obj.transactionId = message.transactionId;
    }
    return obj;
  },

  create<I extends Exact<DeepPartial<CommitRequest>, I>>(base?: I): CommitRequest {
    return CommitRequest.fromPartial(base ?? ({} as any));
  },
  fromPartial<I extends Exact<DeepPartial<CommitRequest>, I>>(object: I): CommitRequest {
    const message = createBaseCommitRequest();
    message.sessionId = object.sessionId ?? "";
    message.transactionId = object.transactionId ?? "";
    return message;
  },
};

function createBaseCommitResponse(): CommitResponse {
  return { status: undefined };
}

export const CommitResponse: MessageFns<CommitResponse> = {
  encode(message: CommitResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
    if (message.status !== undefined) {
      GqlStatus.encode(message.status, writer.uint32(10).fork()).join();
    }
    return writer;
  },

  decode(input: BinaryReader | Uint8Array, length?: number): CommitResponse {
    const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
    const end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseCommitResponse();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1: {
          if (tag !== 10) {
            break;
          }

          message.status = GqlStatus.decode(reader, reader.uint32());
          continue;
        }
      }
      if ((tag & 7) === 4 || tag === 0) {
        break;
      }
      reader.skip(tag & 7);
    }
    return message;
  },

  fromJSON(object: any): CommitResponse {
    return { status: isSet(object.status) ? GqlStatus.fromJSON(object.status) : undefined };
  },

  toJSON(message: CommitResponse): unknown {
    const obj: any = {};
    if (message.status !== undefined) {
      obj.status = GqlStatus.toJSON(message.status);
    }
    return obj;
  },

  create<I extends Exact<DeepPartial<CommitResponse>, I>>(base?: I): CommitResponse {
    return CommitResponse.fromPartial(base ?? ({} as any));
  },
  fromPartial<I extends Exact<DeepPartial<CommitResponse>, I>>(object: I): CommitResponse {
    const message = createBaseCommitResponse();
    message.status = (object.status !== undefined && object.status !== null)
      ? GqlStatus.fromPartial(object.status)
      : undefined;
    return message;
  },
};

function createBaseRollbackRequest(): RollbackRequest {
  return { sessionId: "", transactionId: "" };
}

export const RollbackRequest: MessageFns<RollbackRequest> = {
  encode(message: RollbackRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
    if (message.sessionId !== "") {
      writer.uint32(10).string(message.sessionId);
    }
    if (message.transactionId !== "") {
      writer.uint32(18).string(message.transactionId);
    }
    return writer;
  },

  decode(input: BinaryReader | Uint8Array, length?: number): RollbackRequest {
    const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
    const end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseRollbackRequest();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1: {
          if (tag !== 10) {
            break;
          }

          message.sessionId = reader.string();
          continue;
        }
        case 2: {
          if (tag !== 18) {
            break;
          }

          message.transactionId = reader.string();
          continue;
        }
      }
      if ((tag & 7) === 4 || tag === 0) {
        break;
      }
      reader.skip(tag & 7);
    }
    return message;
  },

  fromJSON(object: any): RollbackRequest {
    return {
      sessionId: isSet(object.sessionId)
        ? globalThis.String(object.sessionId)
        : isSet(object.session_id)
        ? globalThis.String(object.session_id)
        : "",
      transactionId: isSet(object.transactionId)
        ? globalThis.String(object.transactionId)
        : isSet(object.transaction_id)
        ? globalThis.String(object.transaction_id)
        : "",
    };
  },

  toJSON(message: RollbackRequest): unknown {
    const obj: any = {};
    if (message.sessionId !== "") {
      obj.sessionId = message.sessionId;
    }
    if (message.transactionId !== "") {
      obj.transactionId = message.transactionId;
    }
    return obj;
  },

  create<I extends Exact<DeepPartial<RollbackRequest>, I>>(base?: I): RollbackRequest {
    return RollbackRequest.fromPartial(base ?? ({} as any));
  },
  fromPartial<I extends Exact<DeepPartial<RollbackRequest>, I>>(object: I): RollbackRequest {
    const message = createBaseRollbackRequest();
    message.sessionId = object.sessionId ?? "";
    message.transactionId = object.transactionId ?? "";
    return message;
  },
};

function createBaseRollbackResponse(): RollbackResponse {
  return { status: undefined };
}

export const RollbackResponse: MessageFns<RollbackResponse> = {
  encode(message: RollbackResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
    if (message.status !== undefined) {
      GqlStatus.encode(message.status, writer.uint32(10).fork()).join();
    }
    return writer;
  },

  decode(input: BinaryReader | Uint8Array, length?: number): RollbackResponse {
    const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
    const end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseRollbackResponse();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1: {
          if (tag !== 10) {
            break;
          }

          message.status = GqlStatus.decode(reader, reader.uint32());
          continue;
        }
      }
      if ((tag & 7) === 4 || tag === 0) {
        break;
      }
      reader.skip(tag & 7);
    }
    return message;
  },

  fromJSON(object: any): RollbackResponse {
    return { status: isSet(object.status) ? GqlStatus.fromJSON(object.status) : undefined };
  },

  toJSON(message: RollbackResponse): unknown {
    const obj: any = {};
    if (message.status !== undefined) {
      obj.status = GqlStatus.toJSON(message.status);
    }
    return obj;
  },

  create<I extends Exact<DeepPartial<RollbackResponse>, I>>(base?: I): RollbackResponse {
    return RollbackResponse.fromPartial(base ?? ({} as any));
  },
  fromPartial<I extends Exact<DeepPartial<RollbackResponse>, I>>(object: I): RollbackResponse {
    const message = createBaseRollbackResponse();
    message.status = (object.status !== undefined && object.status !== null)
      ? GqlStatus.fromPartial(object.status)
      : undefined;
    return message;
  },
};

function createBaseListSchemasRequest(): ListSchemasRequest {
  return {};
}

export const ListSchemasRequest: MessageFns<ListSchemasRequest> = {
  encode(_: ListSchemasRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
    return writer;
  },

  decode(input: BinaryReader | Uint8Array, length?: number): ListSchemasRequest {
    const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
    const end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseListSchemasRequest();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
      }
      if ((tag & 7) === 4 || tag === 0) {
        break;
      }
      reader.skip(tag & 7);
    }
    return message;
  },

  fromJSON(_: any): ListSchemasRequest {
    return {};
  },

  toJSON(_: ListSchemasRequest): unknown {
    const obj: any = {};
    return obj;
  },

  create<I extends Exact<DeepPartial<ListSchemasRequest>, I>>(base?: I): ListSchemasRequest {
    return ListSchemasRequest.fromPartial(base ?? ({} as any));
  },
  fromPartial<I extends Exact<DeepPartial<ListSchemasRequest>, I>>(_: I): ListSchemasRequest {
    const message = createBaseListSchemasRequest();
    return message;
  },
};

function createBaseSchemaInfo(): SchemaInfo {
  return { name: "", graphCount: 0, graphTypeCount: 0 };
}

export const SchemaInfo: MessageFns<SchemaInfo> = {
  encode(message: SchemaInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
    if (message.name !== "") {
      writer.uint32(10).string(message.name);
    }
    if (message.graphCount !== 0) {
      writer.uint32(16).uint32(message.graphCount);
    }
    if (message.graphTypeCount !== 0) {
      writer.uint32(24).uint32(message.graphTypeCount);
    }
    return writer;
  },

  decode(input: BinaryReader | Uint8Array, length?: number): SchemaInfo {
    const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
    const end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseSchemaInfo();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1: {
          if (tag !== 10) {
            break;
          }

          message.name = reader.string();
          continue;
        }
        case 2: {
          if (tag !== 16) {
            break;
          }

          message.graphCount = reader.uint32();
          continue;
        }
        case 3: {
          if (tag !== 24) {
            break;
          }

          message.graphTypeCount = reader.uint32();
          continue;
        }
      }
      if ((tag & 7) === 4 || tag === 0) {
        break;
      }
      reader.skip(tag & 7);
    }
    return message;
  },

  fromJSON(object: any): SchemaInfo {
    return {
      name: isSet(object.name) ? globalThis.String(object.name) : "",
      graphCount: isSet(object.graphCount)
        ? globalThis.Number(object.graphCount)
        : isSet(object.graph_count)
        ? globalThis.Number(object.graph_count)
        : 0,
      graphTypeCount: isSet(object.graphTypeCount)
        ? globalThis.Number(object.graphTypeCount)
        : isSet(object.graph_type_count)
        ? globalThis.Number(object.graph_type_count)
        : 0,
    };
  },

  toJSON(message: SchemaInfo): unknown {
    const obj: any = {};
    if (message.name !== "") {
      obj.name = message.name;
    }
    if (message.graphCount !== 0) {
      obj.graphCount = Math.round(message.graphCount);
    }
    if (message.graphTypeCount !== 0) {
      obj.graphTypeCount = Math.round(message.graphTypeCount);
    }
    return obj;
  },

  create<I extends Exact<DeepPartial<SchemaInfo>, I>>(base?: I): SchemaInfo {
    return SchemaInfo.fromPartial(base ?? ({} as any));
  },
  fromPartial<I extends Exact<DeepPartial<SchemaInfo>, I>>(object: I): SchemaInfo {
    const message = createBaseSchemaInfo();
    message.name = object.name ?? "";
    message.graphCount = object.graphCount ?? 0;
    message.graphTypeCount = object.graphTypeCount ?? 0;
    return message;
  },
};

function createBaseListSchemasResponse(): ListSchemasResponse {
  return { schemas: [] };
}

export const ListSchemasResponse: MessageFns<ListSchemasResponse> = {
  encode(message: ListSchemasResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
    for (const v of message.schemas) {
      SchemaInfo.encode(v!, writer.uint32(10).fork()).join();
    }
    return writer;
  },

  decode(input: BinaryReader | Uint8Array, length?: number): ListSchemasResponse {
    const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
    const end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseListSchemasResponse();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1: {
          if (tag !== 10) {
            break;
          }

          message.schemas.push(SchemaInfo.decode(reader, reader.uint32()));
          continue;
        }
      }
      if ((tag & 7) === 4 || tag === 0) {
        break;
      }
      reader.skip(tag & 7);
    }
    return message;
  },

  fromJSON(object: any): ListSchemasResponse {
    return {
      schemas: globalThis.Array.isArray(object?.schemas) ? object.schemas.map((e: any) => SchemaInfo.fromJSON(e)) : [],
    };
  },

  toJSON(message: ListSchemasResponse): unknown {
    const obj: any = {};
    if (message.schemas?.length) {
      obj.schemas = message.schemas.map((e) => SchemaInfo.toJSON(e));
    }
    return obj;
  },

  create<I extends Exact<DeepPartial<ListSchemasResponse>, I>>(base?: I): ListSchemasResponse {
    return ListSchemasResponse.fromPartial(base ?? ({} as any));
  },
  fromPartial<I extends Exact<DeepPartial<ListSchemasResponse>, I>>(object: I): ListSchemasResponse {
    const message = createBaseListSchemasResponse();
    message.schemas = object.schemas?.map((e) => SchemaInfo.fromPartial(e)) || [];
    return message;
  },
};

function createBaseCreateSchemaRequest(): CreateSchemaRequest {
  return { name: "", ifNotExists: false };
}

export const CreateSchemaRequest: MessageFns<CreateSchemaRequest> = {
  encode(message: CreateSchemaRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
    if (message.name !== "") {
      writer.uint32(10).string(message.name);
    }
    if (message.ifNotExists !== false) {
      writer.uint32(16).bool(message.ifNotExists);
    }
    return writer;
  },

  decode(input: BinaryReader | Uint8Array, length?: number): CreateSchemaRequest {
    const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
    const end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseCreateSchemaRequest();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1: {
          if (tag !== 10) {
            break;
          }

          message.name = reader.string();
          continue;
        }
        case 2: {
          if (tag !== 16) {
            break;
          }

          message.ifNotExists = reader.bool();
          continue;
        }
      }
      if ((tag & 7) === 4 || tag === 0) {
        break;
      }
      reader.skip(tag & 7);
    }
    return message;
  },

  fromJSON(object: any): CreateSchemaRequest {
    return {
      name: isSet(object.name) ? globalThis.String(object.name) : "",
      ifNotExists: isSet(object.ifNotExists)
        ? globalThis.Boolean(object.ifNotExists)
        : isSet(object.if_not_exists)
        ? globalThis.Boolean(object.if_not_exists)
        : false,
    };
  },

  toJSON(message: CreateSchemaRequest): unknown {
    const obj: any = {};
    if (message.name !== "") {
      obj.name = message.name;
    }
    if (message.ifNotExists !== false) {
      obj.ifNotExists = message.ifNotExists;
    }
    return obj;
  },

  create<I extends Exact<DeepPartial<CreateSchemaRequest>, I>>(base?: I): CreateSchemaRequest {
    return CreateSchemaRequest.fromPartial(base ?? ({} as any));
  },
  fromPartial<I extends Exact<DeepPartial<CreateSchemaRequest>, I>>(object: I): CreateSchemaRequest {
    const message = createBaseCreateSchemaRequest();
    message.name = object.name ?? "";
    message.ifNotExists = object.ifNotExists ?? false;
    return message;
  },
};

function createBaseCreateSchemaResponse(): CreateSchemaResponse {
  return {};
}

export const CreateSchemaResponse: MessageFns<CreateSchemaResponse> = {
  encode(_: CreateSchemaResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
    return writer;
  },

  decode(input: BinaryReader | Uint8Array, length?: number): CreateSchemaResponse {
    const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
    const end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseCreateSchemaResponse();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
      }
      if ((tag & 7) === 4 || tag === 0) {
        break;
      }
      reader.skip(tag & 7);
    }
    return message;
  },

  fromJSON(_: any): CreateSchemaResponse {
    return {};
  },

  toJSON(_: CreateSchemaResponse): unknown {
    const obj: any = {};
    return obj;
  },

  create<I extends Exact<DeepPartial<CreateSchemaResponse>, I>>(base?: I): CreateSchemaResponse {
    return CreateSchemaResponse.fromPartial(base ?? ({} as any));
  },
  fromPartial<I extends Exact<DeepPartial<CreateSchemaResponse>, I>>(_: I): CreateSchemaResponse {
    const message = createBaseCreateSchemaResponse();
    return message;
  },
};

function createBaseDropSchemaRequest(): DropSchemaRequest {
  return { name: "", ifExists: false };
}

export const DropSchemaRequest: MessageFns<DropSchemaRequest> = {
  encode(message: DropSchemaRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
    if (message.name !== "") {
      writer.uint32(10).string(message.name);
    }
    if (message.ifExists !== false) {
      writer.uint32(16).bool(message.ifExists);
    }
    return writer;
  },

  decode(input: BinaryReader | Uint8Array, length?: number): DropSchemaRequest {
    const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
    const end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseDropSchemaRequest();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1: {
          if (tag !== 10) {
            break;
          }

          message.name = reader.string();
          continue;
        }
        case 2: {
          if (tag !== 16) {
            break;
          }

          message.ifExists = reader.bool();
          continue;
        }
      }
      if ((tag & 7) === 4 || tag === 0) {
        break;
      }
      reader.skip(tag & 7);
    }
    return message;
  },

  fromJSON(object: any): DropSchemaRequest {
    return {
      name: isSet(object.name) ? globalThis.String(object.name) : "",
      ifExists: isSet(object.ifExists)
        ? globalThis.Boolean(object.ifExists)
        : isSet(object.if_exists)
        ? globalThis.Boolean(object.if_exists)
        : false,
    };
  },

  toJSON(message: DropSchemaRequest): unknown {
    const obj: any = {};
    if (message.name !== "") {
      obj.name = message.name;
    }
    if (message.ifExists !== false) {
      obj.ifExists = message.ifExists;
    }
    return obj;
  },

  create<I extends Exact<DeepPartial<DropSchemaRequest>, I>>(base?: I): DropSchemaRequest {
    return DropSchemaRequest.fromPartial(base ?? ({} as any));
  },
  fromPartial<I extends Exact<DeepPartial<DropSchemaRequest>, I>>(object: I): DropSchemaRequest {
    const message = createBaseDropSchemaRequest();
    message.name = object.name ?? "";
    message.ifExists = object.ifExists ?? false;
    return message;
  },
};

function createBaseDropSchemaResponse(): DropSchemaResponse {
  return { existed: false };
}

export const DropSchemaResponse: MessageFns<DropSchemaResponse> = {
  encode(message: DropSchemaResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
    if (message.existed !== false) {
      writer.uint32(8).bool(message.existed);
    }
    return writer;
  },

  decode(input: BinaryReader | Uint8Array, length?: number): DropSchemaResponse {
    const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
    const end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseDropSchemaResponse();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1: {
          if (tag !== 8) {
            break;
          }

          message.existed = reader.bool();
          continue;
        }
      }
      if ((tag & 7) === 4 || tag === 0) {
        break;
      }
      reader.skip(tag & 7);
    }
    return message;
  },

  fromJSON(object: any): DropSchemaResponse {
    return { existed: isSet(object.existed) ? globalThis.Boolean(object.existed) : false };
  },

  toJSON(message: DropSchemaResponse): unknown {
    const obj: any = {};
    if (message.existed !== false) {
      obj.existed = message.existed;
    }
    return obj;
  },

  create<I extends Exact<DeepPartial<DropSchemaResponse>, I>>(base?: I): DropSchemaResponse {
    return DropSchemaResponse.fromPartial(base ?? ({} as any));
  },
  fromPartial<I extends Exact<DeepPartial<DropSchemaResponse>, I>>(object: I): DropSchemaResponse {
    const message = createBaseDropSchemaResponse();
    message.existed = object.existed ?? false;
    return message;
  },
};

function createBaseListGraphsRequest(): ListGraphsRequest {
  return { schema: "" };
}

export const ListGraphsRequest: MessageFns<ListGraphsRequest> = {
  encode(message: ListGraphsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
    if (message.schema !== "") {
      writer.uint32(10).string(message.schema);
    }
    return writer;
  },

  decode(input: BinaryReader | Uint8Array, length?: number): ListGraphsRequest {
    const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
    const end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseListGraphsRequest();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1: {
          if (tag !== 10) {
            break;
          }

          message.schema = reader.string();
          continue;
        }
      }
      if ((tag & 7) === 4 || tag === 0) {
        break;
      }
      reader.skip(tag & 7);
    }
    return message;
  },

  fromJSON(object: any): ListGraphsRequest {
    return { schema: isSet(object.schema) ? globalThis.String(object.schema) : "" };
  },

  toJSON(message: ListGraphsRequest): unknown {
    const obj: any = {};
    if (message.schema !== "") {
      obj.schema = message.schema;
    }
    return obj;
  },

  create<I extends Exact<DeepPartial<ListGraphsRequest>, I>>(base?: I): ListGraphsRequest {
    return ListGraphsRequest.fromPartial(base ?? ({} as any));
  },
  fromPartial<I extends Exact<DeepPartial<ListGraphsRequest>, I>>(object: I): ListGraphsRequest {
    const message = createBaseListGraphsRequest();
    message.schema = object.schema ?? "";
    return message;
  },
};

function createBaseGraphSummary(): GraphSummary {
  return { schema: "", name: "", nodeCount: 0n, edgeCount: 0n, graphType: "" };
}

export const GraphSummary: MessageFns<GraphSummary> = {
  encode(message: GraphSummary, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
    if (message.schema !== "") {
      writer.uint32(10).string(message.schema);
    }
    if (message.name !== "") {
      writer.uint32(18).string(message.name);
    }
    if (message.nodeCount !== 0n) {
      if (BigInt.asUintN(64, message.nodeCount) !== message.nodeCount) {
        throw new globalThis.Error("value provided for field message.nodeCount of type uint64 too large");
      }
      writer.uint32(24).uint64(message.nodeCount);
    }
    if (message.edgeCount !== 0n) {
      if (BigInt.asUintN(64, message.edgeCount) !== message.edgeCount) {
        throw new globalThis.Error("value provided for field message.edgeCount of type uint64 too large");
      }
      writer.uint32(32).uint64(message.edgeCount);
    }
    if (message.graphType !== "") {
      writer.uint32(42).string(message.graphType);
    }
    return writer;
  },

  decode(input: BinaryReader | Uint8Array, length?: number): GraphSummary {
    const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
    const end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseGraphSummary();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1: {
          if (tag !== 10) {
            break;
          }

          message.schema = reader.string();
          continue;
        }
        case 2: {
          if (tag !== 18) {
            break;
          }

          message.name = reader.string();
          continue;
        }
        case 3: {
          if (tag !== 24) {
            break;
          }

          message.nodeCount = reader.uint64() as bigint;
          continue;
        }
        case 4: {
          if (tag !== 32) {
            break;
          }

          message.edgeCount = reader.uint64() as bigint;
          continue;
        }
        case 5: {
          if (tag !== 42) {
            break;
          }

          message.graphType = reader.string();
          continue;
        }
      }
      if ((tag & 7) === 4 || tag === 0) {
        break;
      }
      reader.skip(tag & 7);
    }
    return message;
  },

  fromJSON(object: any): GraphSummary {
    return {
      schema: isSet(object.schema) ? globalThis.String(object.schema) : "",
      name: isSet(object.name) ? globalThis.String(object.name) : "",
      nodeCount: isSet(object.nodeCount)
        ? BigInt(object.nodeCount)
        : isSet(object.node_count)
        ? BigInt(object.node_count)
        : 0n,
      edgeCount: isSet(object.edgeCount)
        ? BigInt(object.edgeCount)
        : isSet(object.edge_count)
        ? BigInt(object.edge_count)
        : 0n,
      graphType: isSet(object.graphType)
        ? globalThis.String(object.graphType)
        : isSet(object.graph_type)
        ? globalThis.String(object.graph_type)
        : "",
    };
  },

  toJSON(message: GraphSummary): unknown {
    const obj: any = {};
    if (message.schema !== "") {
      obj.schema = message.schema;
    }
    if (message.name !== "") {
      obj.name = message.name;
    }
    if (message.nodeCount !== 0n) {
      obj.nodeCount = message.nodeCount.toString();
    }
    if (message.edgeCount !== 0n) {
      obj.edgeCount = message.edgeCount.toString();
    }
    if (message.graphType !== "") {
      obj.graphType = message.graphType;
    }
    return obj;
  },

  create<I extends Exact<DeepPartial<GraphSummary>, I>>(base?: I): GraphSummary {
    return GraphSummary.fromPartial(base ?? ({} as any));
  },
  fromPartial<I extends Exact<DeepPartial<GraphSummary>, I>>(object: I): GraphSummary {
    const message = createBaseGraphSummary();
    message.schema = object.schema ?? "";
    message.name = object.name ?? "";
    message.nodeCount = object.nodeCount ?? 0n;
    message.edgeCount = object.edgeCount ?? 0n;
    message.graphType = object.graphType ?? "";
    return message;
  },
};

function createBaseListGraphsResponse(): ListGraphsResponse {
  return { graphs: [] };
}

export const ListGraphsResponse: MessageFns<ListGraphsResponse> = {
  encode(message: ListGraphsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
    for (const v of message.graphs) {
      GraphSummary.encode(v!, writer.uint32(10).fork()).join();
    }
    return writer;
  },

  decode(input: BinaryReader | Uint8Array, length?: number): ListGraphsResponse {
    const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
    const end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseListGraphsResponse();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1: {
          if (tag !== 10) {
            break;
          }

          message.graphs.push(GraphSummary.decode(reader, reader.uint32()));
          continue;
        }
      }
      if ((tag & 7) === 4 || tag === 0) {
        break;
      }
      reader.skip(tag & 7);
    }
    return message;
  },

  fromJSON(object: any): ListGraphsResponse {
    return {
      graphs: globalThis.Array.isArray(object?.graphs) ? object.graphs.map((e: any) => GraphSummary.fromJSON(e)) : [],
    };
  },

  toJSON(message: ListGraphsResponse): unknown {
    const obj: any = {};
    if (message.graphs?.length) {
      obj.graphs = message.graphs.map((e) => GraphSummary.toJSON(e));
    }
    return obj;
  },

  create<I extends Exact<DeepPartial<ListGraphsResponse>, I>>(base?: I): ListGraphsResponse {
    return ListGraphsResponse.fromPartial(base ?? ({} as any));
  },
  fromPartial<I extends Exact<DeepPartial<ListGraphsResponse>, I>>(object: I): ListGraphsResponse {
    const message = createBaseListGraphsResponse();
    message.graphs = object.graphs?.map((e) => GraphSummary.fromPartial(e)) || [];
    return message;
  },
};

function createBaseCreateGraphRequest(): CreateGraphRequest {
  return {
    schema: "",
    name: "",
    ifNotExists: false,
    orReplace: false,
    openType: undefined,
    graphTypeRef: undefined,
    copyOf: undefined,
    storageMode: "",
    options: undefined,
  };
}

export const CreateGraphRequest: MessageFns<CreateGraphRequest> = {
  encode(message: CreateGraphRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
    if (message.schema !== "") {
      writer.uint32(10).string(message.schema);
    }
    if (message.name !== "") {
      writer.uint32(18).string(message.name);
    }
    if (message.ifNotExists !== false) {
      writer.uint32(24).bool(message.ifNotExists);
    }
    if (message.orReplace !== false) {
      writer.uint32(32).bool(message.orReplace);
    }
    if (message.openType !== undefined) {
      writer.uint32(40).bool(message.openType);
    }
    if (message.graphTypeRef !== undefined) {
      writer.uint32(50).string(message.graphTypeRef);
    }
    if (message.copyOf !== undefined) {
      writer.uint32(58).string(message.copyOf);
    }
    if (message.storageMode !== "") {
      writer.uint32(82).string(message.storageMode);
    }
    if (message.options !== undefined) {
      GraphOptions.encode(message.options, writer.uint32(90).fork()).join();
    }
    return writer;
  },

  decode(input: BinaryReader | Uint8Array, length?: number): CreateGraphRequest {
    const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
    const end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseCreateGraphRequest();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1: {
          if (tag !== 10) {
            break;
          }

          message.schema = reader.string();
          continue;
        }
        case 2: {
          if (tag !== 18) {
            break;
          }

          message.name = reader.string();
          continue;
        }
        case 3: {
          if (tag !== 24) {
            break;
          }

          message.ifNotExists = reader.bool();
          continue;
        }
        case 4: {
          if (tag !== 32) {
            break;
          }

          message.orReplace = reader.bool();
          continue;
        }
        case 5: {
          if (tag !== 40) {
            break;
          }

          message.openType = reader.bool();
          continue;
        }
        case 6: {
          if (tag !== 50) {
            break;
          }

          message.graphTypeRef = reader.string();
          continue;
        }
        case 7: {
          if (tag !== 58) {
            break;
          }

          message.copyOf = reader.string();
          continue;
        }
        case 10: {
          if (tag !== 82) {
            break;
          }

          message.storageMode = reader.string();
          continue;
        }
        case 11: {
          if (tag !== 90) {
            break;
          }

          message.options = GraphOptions.decode(reader, reader.uint32());
          continue;
        }
      }
      if ((tag & 7) === 4 || tag === 0) {
        break;
      }
      reader.skip(tag & 7);
    }
    return message;
  },

  fromJSON(object: any): CreateGraphRequest {
    return {
      schema: isSet(object.schema) ? globalThis.String(object.schema) : "",
      name: isSet(object.name) ? globalThis.String(object.name) : "",
      ifNotExists: isSet(object.ifNotExists)
        ? globalThis.Boolean(object.ifNotExists)
        : isSet(object.if_not_exists)
        ? globalThis.Boolean(object.if_not_exists)
        : false,
      orReplace: isSet(object.orReplace)
        ? globalThis.Boolean(object.orReplace)
        : isSet(object.or_replace)
        ? globalThis.Boolean(object.or_replace)
        : false,
      openType: isSet(object.openType)
        ? globalThis.Boolean(object.openType)
        : isSet(object.open_type)
        ? globalThis.Boolean(object.open_type)
        : undefined,
      graphTypeRef: isSet(object.graphTypeRef)
        ? globalThis.String(object.graphTypeRef)
        : isSet(object.graph_type_ref)
        ? globalThis.String(object.graph_type_ref)
        : undefined,
      copyOf: isSet(object.copyOf)
        ? globalThis.String(object.copyOf)
        : isSet(object.copy_of)
        ? globalThis.String(object.copy_of)
        : undefined,
      storageMode: isSet(object.storageMode)
        ? globalThis.String(object.storageMode)
        : isSet(object.storage_mode)
        ? globalThis.String(object.storage_mode)
        : "",
      options: isSet(object.options) ? GraphOptions.fromJSON(object.options) : undefined,
    };
  },

  toJSON(message: CreateGraphRequest): unknown {
    const obj: any = {};
    if (message.schema !== "") {
      obj.schema = message.schema;
    }
    if (message.name !== "") {
      obj.name = message.name;
    }
    if (message.ifNotExists !== false) {
      obj.ifNotExists = message.ifNotExists;
    }
    if (message.orReplace !== false) {
      obj.orReplace = message.orReplace;
    }
    if (message.openType !== undefined) {
      obj.openType = message.openType;
    }
    if (message.graphTypeRef !== undefined) {
      obj.graphTypeRef = message.graphTypeRef;
    }
    if (message.copyOf !== undefined) {
      obj.copyOf = message.copyOf;
    }
    if (message.storageMode !== "") {
      obj.storageMode = message.storageMode;
    }
    if (message.options !== undefined) {
      obj.options = GraphOptions.toJSON(message.options);
    }
    return obj;
  },

  create<I extends Exact<DeepPartial<CreateGraphRequest>, I>>(base?: I): CreateGraphRequest {
    return CreateGraphRequest.fromPartial(base ?? ({} as any));
  },
  fromPartial<I extends Exact<DeepPartial<CreateGraphRequest>, I>>(object: I): CreateGraphRequest {
    const message = createBaseCreateGraphRequest();
    message.schema = object.schema ?? "";
    message.name = object.name ?? "";
    message.ifNotExists = object.ifNotExists ?? false;
    message.orReplace = object.orReplace ?? false;
    message.openType = object.openType ?? undefined;
    message.graphTypeRef = object.graphTypeRef ?? undefined;
    message.copyOf = object.copyOf ?? undefined;
    message.storageMode = object.storageMode ?? "";
    message.options = (object.options !== undefined && object.options !== null)
      ? GraphOptions.fromPartial(object.options)
      : undefined;
    return message;
  },
};

function createBaseGraphOptions(): GraphOptions {
  return {
    memoryLimitBytes: undefined,
    backwardEdges: undefined,
    threads: undefined,
    walEnabled: undefined,
    walDurability: undefined,
  };
}

export const GraphOptions: MessageFns<GraphOptions> = {
  encode(message: GraphOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
    if (message.memoryLimitBytes !== undefined) {
      if (BigInt.asUintN(64, message.memoryLimitBytes) !== message.memoryLimitBytes) {
        throw new globalThis.Error("value provided for field message.memoryLimitBytes of type uint64 too large");
      }
      writer.uint32(8).uint64(message.memoryLimitBytes);
    }
    if (message.backwardEdges !== undefined) {
      writer.uint32(16).bool(message.backwardEdges);
    }
    if (message.threads !== undefined) {
      writer.uint32(24).uint32(message.threads);
    }
    if (message.walEnabled !== undefined) {
      writer.uint32(32).bool(message.walEnabled);
    }
    if (message.walDurability !== undefined) {
      writer.uint32(42).string(message.walDurability);
    }
    return writer;
  },

  decode(input: BinaryReader | Uint8Array, length?: number): GraphOptions {
    const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
    const end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseGraphOptions();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1: {
          if (tag !== 8) {
            break;
          }

          message.memoryLimitBytes = reader.uint64() as bigint;
          continue;
        }
        case 2: {
          if (tag !== 16) {
            break;
          }

          message.backwardEdges = reader.bool();
          continue;
        }
        case 3: {
          if (tag !== 24) {
            break;
          }

          message.threads = reader.uint32();
          continue;
        }
        case 4: {
          if (tag !== 32) {
            break;
          }

          message.walEnabled = reader.bool();
          continue;
        }
        case 5: {
          if (tag !== 42) {
            break;
          }

          message.walDurability = reader.string();
          continue;
        }
      }
      if ((tag & 7) === 4 || tag === 0) {
        break;
      }
      reader.skip(tag & 7);
    }
    return message;
  },

  fromJSON(object: any): GraphOptions {
    return {
      memoryLimitBytes: isSet(object.memoryLimitBytes)
        ? BigInt(object.memoryLimitBytes)
        : isSet(object.memory_limit_bytes)
        ? BigInt(object.memory_limit_bytes)
        : undefined,
      backwardEdges: isSet(object.backwardEdges)
        ? globalThis.Boolean(object.backwardEdges)
        : isSet(object.backward_edges)
        ? globalThis.Boolean(object.backward_edges)
        : undefined,
      threads: isSet(object.threads) ? globalThis.Number(object.threads) : undefined,
      walEnabled: isSet(object.walEnabled)
        ? globalThis.Boolean(object.walEnabled)
        : isSet(object.wal_enabled)
        ? globalThis.Boolean(object.wal_enabled)
        : undefined,
      walDurability: isSet(object.walDurability)
        ? globalThis.String(object.walDurability)
        : isSet(object.wal_durability)
        ? globalThis.String(object.wal_durability)
        : undefined,
    };
  },

  toJSON(message: GraphOptions): unknown {
    const obj: any = {};
    if (message.memoryLimitBytes !== undefined) {
      obj.memoryLimitBytes = message.memoryLimitBytes.toString();
    }
    if (message.backwardEdges !== undefined) {
      obj.backwardEdges = message.backwardEdges;
    }
    if (message.threads !== undefined) {
      obj.threads = Math.round(message.threads);
    }
    if (message.walEnabled !== undefined) {
      obj.walEnabled = message.walEnabled;
    }
    if (message.walDurability !== undefined) {
      obj.walDurability = message.walDurability;
    }
    return obj;
  },

  create<I extends Exact<DeepPartial<GraphOptions>, I>>(base?: I): GraphOptions {
    return GraphOptions.fromPartial(base ?? ({} as any));
  },
  fromPartial<I extends Exact<DeepPartial<GraphOptions>, I>>(object: I): GraphOptions {
    const message = createBaseGraphOptions();
    message.memoryLimitBytes = object.memoryLimitBytes ?? undefined;
    message.backwardEdges = object.backwardEdges ?? undefined;
    message.threads = object.threads ?? undefined;
    message.walEnabled = object.walEnabled ?? undefined;
    message.walDurability = object.walDurability ?? undefined;
    return message;
  },
};

function createBaseCreateGraphResponse(): CreateGraphResponse {
  return { graph: undefined };
}

export const CreateGraphResponse: MessageFns<CreateGraphResponse> = {
  encode(message: CreateGraphResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
    if (message.graph !== undefined) {
      GraphSummary.encode(message.graph, writer.uint32(10).fork()).join();
    }
    return writer;
  },

  decode(input: BinaryReader | Uint8Array, length?: number): CreateGraphResponse {
    const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
    const end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseCreateGraphResponse();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1: {
          if (tag !== 10) {
            break;
          }

          message.graph = GraphSummary.decode(reader, reader.uint32());
          continue;
        }
      }
      if ((tag & 7) === 4 || tag === 0) {
        break;
      }
      reader.skip(tag & 7);
    }
    return message;
  },

  fromJSON(object: any): CreateGraphResponse {
    return { graph: isSet(object.graph) ? GraphSummary.fromJSON(object.graph) : undefined };
  },

  toJSON(message: CreateGraphResponse): unknown {
    const obj: any = {};
    if (message.graph !== undefined) {
      obj.graph = GraphSummary.toJSON(message.graph);
    }
    return obj;
  },

  create<I extends Exact<DeepPartial<CreateGraphResponse>, I>>(base?: I): CreateGraphResponse {
    return CreateGraphResponse.fromPartial(base ?? ({} as any));
  },
  fromPartial<I extends Exact<DeepPartial<CreateGraphResponse>, I>>(object: I): CreateGraphResponse {
    const message = createBaseCreateGraphResponse();
    message.graph = (object.graph !== undefined && object.graph !== null)
      ? GraphSummary.fromPartial(object.graph)
      : undefined;
    return message;
  },
};

function createBaseDropGraphRequest(): DropGraphRequest {
  return { schema: "", name: "", ifExists: false };
}

export const DropGraphRequest: MessageFns<DropGraphRequest> = {
  encode(message: DropGraphRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
    if (message.schema !== "") {
      writer.uint32(10).string(message.schema);
    }
    if (message.name !== "") {
      writer.uint32(18).string(message.name);
    }
    if (message.ifExists !== false) {
      writer.uint32(24).bool(message.ifExists);
    }
    return writer;
  },

  decode(input: BinaryReader | Uint8Array, length?: number): DropGraphRequest {
    const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
    const end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseDropGraphRequest();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1: {
          if (tag !== 10) {
            break;
          }

          message.schema = reader.string();
          continue;
        }
        case 2: {
          if (tag !== 18) {
            break;
          }

          message.name = reader.string();
          continue;
        }
        case 3: {
          if (tag !== 24) {
            break;
          }

          message.ifExists = reader.bool();
          continue;
        }
      }
      if ((tag & 7) === 4 || tag === 0) {
        break;
      }
      reader.skip(tag & 7);
    }
    return message;
  },

  fromJSON(object: any): DropGraphRequest {
    return {
      schema: isSet(object.schema) ? globalThis.String(object.schema) : "",
      name: isSet(object.name) ? globalThis.String(object.name) : "",
      ifExists: isSet(object.ifExists)
        ? globalThis.Boolean(object.ifExists)
        : isSet(object.if_exists)
        ? globalThis.Boolean(object.if_exists)
        : false,
    };
  },

  toJSON(message: DropGraphRequest): unknown {
    const obj: any = {};
    if (message.schema !== "") {
      obj.schema = message.schema;
    }
    if (message.name !== "") {
      obj.name = message.name;
    }
    if (message.ifExists !== false) {
      obj.ifExists = message.ifExists;
    }
    return obj;
  },

  create<I extends Exact<DeepPartial<DropGraphRequest>, I>>(base?: I): DropGraphRequest {
    return DropGraphRequest.fromPartial(base ?? ({} as any));
  },
  fromPartial<I extends Exact<DeepPartial<DropGraphRequest>, I>>(object: I): DropGraphRequest {
    const message = createBaseDropGraphRequest();
    message.schema = object.schema ?? "";
    message.name = object.name ?? "";
    message.ifExists = object.ifExists ?? false;
    return message;
  },
};

function createBaseDropGraphResponse(): DropGraphResponse {
  return { existed: false };
}

export const DropGraphResponse: MessageFns<DropGraphResponse> = {
  encode(message: DropGraphResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
    if (message.existed !== false) {
      writer.uint32(8).bool(message.existed);
    }
    return writer;
  },

  decode(input: BinaryReader | Uint8Array, length?: number): DropGraphResponse {
    const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
    const end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseDropGraphResponse();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1: {
          if (tag !== 8) {
            break;
          }

          message.existed = reader.bool();
          continue;
        }
      }
      if ((tag & 7) === 4 || tag === 0) {
        break;
      }
      reader.skip(tag & 7);
    }
    return message;
  },

  fromJSON(object: any): DropGraphResponse {
    return { existed: isSet(object.existed) ? globalThis.Boolean(object.existed) : false };
  },

  toJSON(message: DropGraphResponse): unknown {
    const obj: any = {};
    if (message.existed !== false) {
      obj.existed = message.existed;
    }
    return obj;
  },

  create<I extends Exact<DeepPartial<DropGraphResponse>, I>>(base?: I): DropGraphResponse {
    return DropGraphResponse.fromPartial(base ?? ({} as any));
  },
  fromPartial<I extends Exact<DeepPartial<DropGraphResponse>, I>>(object: I): DropGraphResponse {
    const message = createBaseDropGraphResponse();
    message.existed = object.existed ?? false;
    return message;
  },
};

function createBaseGetGraphInfoRequest(): GetGraphInfoRequest {
  return { schema: "", name: "" };
}

export const GetGraphInfoRequest: MessageFns<GetGraphInfoRequest> = {
  encode(message: GetGraphInfoRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
    if (message.schema !== "") {
      writer.uint32(10).string(message.schema);
    }
    if (message.name !== "") {
      writer.uint32(18).string(message.name);
    }
    return writer;
  },

  decode(input: BinaryReader | Uint8Array, length?: number): GetGraphInfoRequest {
    const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
    const end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseGetGraphInfoRequest();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1: {
          if (tag !== 10) {
            break;
          }

          message.schema = reader.string();
          continue;
        }
        case 2: {
          if (tag !== 18) {
            break;
          }

          message.name = reader.string();
          continue;
        }
      }
      if ((tag & 7) === 4 || tag === 0) {
        break;
      }
      reader.skip(tag & 7);
    }
    return message;
  },

  fromJSON(object: any): GetGraphInfoRequest {
    return {
      schema: isSet(object.schema) ? globalThis.String(object.schema) : "",
      name: isSet(object.name) ? globalThis.String(object.name) : "",
    };
  },

  toJSON(message: GetGraphInfoRequest): unknown {
    const obj: any = {};
    if (message.schema !== "") {
      obj.schema = message.schema;
    }
    if (message.name !== "") {
      obj.name = message.name;
    }
    return obj;
  },

  create<I extends Exact<DeepPartial<GetGraphInfoRequest>, I>>(base?: I): GetGraphInfoRequest {
    return GetGraphInfoRequest.fromPartial(base ?? ({} as any));
  },
  fromPartial<I extends Exact<DeepPartial<GetGraphInfoRequest>, I>>(object: I): GetGraphInfoRequest {
    const message = createBaseGetGraphInfoRequest();
    message.schema = object.schema ?? "";
    message.name = object.name ?? "";
    return message;
  },
};

function createBaseGetGraphInfoResponse(): GetGraphInfoResponse {
  return {
    schema: "",
    name: "",
    nodeCount: 0n,
    edgeCount: 0n,
    graphType: "",
    storageMode: "",
    memoryLimitBytes: 0n,
    backwardEdges: false,
    threads: 0,
  };
}

export const GetGraphInfoResponse: MessageFns<GetGraphInfoResponse> = {
  encode(message: GetGraphInfoResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
    if (message.schema !== "") {
      writer.uint32(10).string(message.schema);
    }
    if (message.name !== "") {
      writer.uint32(18).string(message.name);
    }
    if (message.nodeCount !== 0n) {
      if (BigInt.asUintN(64, message.nodeCount) !== message.nodeCount) {
        throw new globalThis.Error("value provided for field message.nodeCount of type uint64 too large");
      }
      writer.uint32(24).uint64(message.nodeCount);
    }
    if (message.edgeCount !== 0n) {
      if (BigInt.asUintN(64, message.edgeCount) !== message.edgeCount) {
        throw new globalThis.Error("value provided for field message.edgeCount of type uint64 too large");
      }
      writer.uint32(32).uint64(message.edgeCount);
    }
    if (message.graphType !== "") {
      writer.uint32(42).string(message.graphType);
    }
    if (message.storageMode !== "") {
      writer.uint32(50).string(message.storageMode);
    }
    if (message.memoryLimitBytes !== 0n) {
      if (BigInt.asUintN(64, message.memoryLimitBytes) !== message.memoryLimitBytes) {
        throw new globalThis.Error("value provided for field message.memoryLimitBytes of type uint64 too large");
      }
      writer.uint32(56).uint64(message.memoryLimitBytes);
    }
    if (message.backwardEdges !== false) {
      writer.uint32(64).bool(message.backwardEdges);
    }
    if (message.threads !== 0) {
      writer.uint32(72).uint32(message.threads);
    }
    return writer;
  },

  decode(input: BinaryReader | Uint8Array, length?: number): GetGraphInfoResponse {
    const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
    const end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseGetGraphInfoResponse();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1: {
          if (tag !== 10) {
            break;
          }

          message.schema = reader.string();
          continue;
        }
        case 2: {
          if (tag !== 18) {
            break;
          }

          message.name = reader.string();
          continue;
        }
        case 3: {
          if (tag !== 24) {
            break;
          }

          message.nodeCount = reader.uint64() as bigint;
          continue;
        }
        case 4: {
          if (tag !== 32) {
            break;
          }

          message.edgeCount = reader.uint64() as bigint;
          continue;
        }
        case 5: {
          if (tag !== 42) {
            break;
          }

          message.graphType = reader.string();
          continue;
        }
        case 6: {
          if (tag !== 50) {
            break;
          }

          message.storageMode = reader.string();
          continue;
        }
        case 7: {
          if (tag !== 56) {
            break;
          }

          message.memoryLimitBytes = reader.uint64() as bigint;
          continue;
        }
        case 8: {
          if (tag !== 64) {
            break;
          }

          message.backwardEdges = reader.bool();
          continue;
        }
        case 9: {
          if (tag !== 72) {
            break;
          }

          message.threads = reader.uint32();
          continue;
        }
      }
      if ((tag & 7) === 4 || tag === 0) {
        break;
      }
      reader.skip(tag & 7);
    }
    return message;
  },

  fromJSON(object: any): GetGraphInfoResponse {
    return {
      schema: isSet(object.schema) ? globalThis.String(object.schema) : "",
      name: isSet(object.name) ? globalThis.String(object.name) : "",
      nodeCount: isSet(object.nodeCount)
        ? BigInt(object.nodeCount)
        : isSet(object.node_count)
        ? BigInt(object.node_count)
        : 0n,
      edgeCount: isSet(object.edgeCount)
        ? BigInt(object.edgeCount)
        : isSet(object.edge_count)
        ? BigInt(object.edge_count)
        : 0n,
      graphType: isSet(object.graphType)
        ? globalThis.String(object.graphType)
        : isSet(object.graph_type)
        ? globalThis.String(object.graph_type)
        : "",
      storageMode: isSet(object.storageMode)
        ? globalThis.String(object.storageMode)
        : isSet(object.storage_mode)
        ? globalThis.String(object.storage_mode)
        : "",
      memoryLimitBytes: isSet(object.memoryLimitBytes)
        ? BigInt(object.memoryLimitBytes)
        : isSet(object.memory_limit_bytes)
        ? BigInt(object.memory_limit_bytes)
        : 0n,
      backwardEdges: isSet(object.backwardEdges)
        ? globalThis.Boolean(object.backwardEdges)
        : isSet(object.backward_edges)
        ? globalThis.Boolean(object.backward_edges)
        : false,
      threads: isSet(object.threads) ? globalThis.Number(object.threads) : 0,
    };
  },

  toJSON(message: GetGraphInfoResponse): unknown {
    const obj: any = {};
    if (message.schema !== "") {
      obj.schema = message.schema;
    }
    if (message.name !== "") {
      obj.name = message.name;
    }
    if (message.nodeCount !== 0n) {
      obj.nodeCount = message.nodeCount.toString();
    }
    if (message.edgeCount !== 0n) {
      obj.edgeCount = message.edgeCount.toString();
    }
    if (message.graphType !== "") {
      obj.graphType = message.graphType;
    }
    if (message.storageMode !== "") {
      obj.storageMode = message.storageMode;
    }
    if (message.memoryLimitBytes !== 0n) {
      obj.memoryLimitBytes = message.memoryLimitBytes.toString();
    }
    if (message.backwardEdges !== false) {
      obj.backwardEdges = message.backwardEdges;
    }
    if (message.threads !== 0) {
      obj.threads = Math.round(message.threads);
    }
    return obj;
  },

  create<I extends Exact<DeepPartial<GetGraphInfoResponse>, I>>(base?: I): GetGraphInfoResponse {
    return GetGraphInfoResponse.fromPartial(base ?? ({} as any));
  },
  fromPartial<I extends Exact<DeepPartial<GetGraphInfoResponse>, I>>(object: I): GetGraphInfoResponse {
    const message = createBaseGetGraphInfoResponse();
    message.schema = object.schema ?? "";
    message.name = object.name ?? "";
    message.nodeCount = object.nodeCount ?? 0n;
    message.edgeCount = object.edgeCount ?? 0n;
    message.graphType = object.graphType ?? "";
    message.storageMode = object.storageMode ?? "";
    message.memoryLimitBytes = object.memoryLimitBytes ?? 0n;
    message.backwardEdges = object.backwardEdges ?? false;
    message.threads = object.threads ?? 0;
    return message;
  },
};

function createBaseListGraphTypesRequest(): ListGraphTypesRequest {
  return { schema: "" };
}

export const ListGraphTypesRequest: MessageFns<ListGraphTypesRequest> = {
  encode(message: ListGraphTypesRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
    if (message.schema !== "") {
      writer.uint32(10).string(message.schema);
    }
    return writer;
  },

  decode(input: BinaryReader | Uint8Array, length?: number): ListGraphTypesRequest {
    const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
    const end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseListGraphTypesRequest();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1: {
          if (tag !== 10) {
            break;
          }

          message.schema = reader.string();
          continue;
        }
      }
      if ((tag & 7) === 4 || tag === 0) {
        break;
      }
      reader.skip(tag & 7);
    }
    return message;
  },

  fromJSON(object: any): ListGraphTypesRequest {
    return { schema: isSet(object.schema) ? globalThis.String(object.schema) : "" };
  },

  toJSON(message: ListGraphTypesRequest): unknown {
    const obj: any = {};
    if (message.schema !== "") {
      obj.schema = message.schema;
    }
    return obj;
  },

  create<I extends Exact<DeepPartial<ListGraphTypesRequest>, I>>(base?: I): ListGraphTypesRequest {
    return ListGraphTypesRequest.fromPartial(base ?? ({} as any));
  },
  fromPartial<I extends Exact<DeepPartial<ListGraphTypesRequest>, I>>(object: I): ListGraphTypesRequest {
    const message = createBaseListGraphTypesRequest();
    message.schema = object.schema ?? "";
    return message;
  },
};

function createBaseGraphTypeInfo(): GraphTypeInfo {
  return { schema: "", name: "" };
}

export const GraphTypeInfo: MessageFns<GraphTypeInfo> = {
  encode(message: GraphTypeInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
    if (message.schema !== "") {
      writer.uint32(10).string(message.schema);
    }
    if (message.name !== "") {
      writer.uint32(18).string(message.name);
    }
    return writer;
  },

  decode(input: BinaryReader | Uint8Array, length?: number): GraphTypeInfo {
    const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
    const end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseGraphTypeInfo();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1: {
          if (tag !== 10) {
            break;
          }

          message.schema = reader.string();
          continue;
        }
        case 2: {
          if (tag !== 18) {
            break;
          }

          message.name = reader.string();
          continue;
        }
      }
      if ((tag & 7) === 4 || tag === 0) {
        break;
      }
      reader.skip(tag & 7);
    }
    return message;
  },

  fromJSON(object: any): GraphTypeInfo {
    return {
      schema: isSet(object.schema) ? globalThis.String(object.schema) : "",
      name: isSet(object.name) ? globalThis.String(object.name) : "",
    };
  },

  toJSON(message: GraphTypeInfo): unknown {
    const obj: any = {};
    if (message.schema !== "") {
      obj.schema = message.schema;
    }
    if (message.name !== "") {
      obj.name = message.name;
    }
    return obj;
  },

  create<I extends Exact<DeepPartial<GraphTypeInfo>, I>>(base?: I): GraphTypeInfo {
    return GraphTypeInfo.fromPartial(base ?? ({} as any));
  },
  fromPartial<I extends Exact<DeepPartial<GraphTypeInfo>, I>>(object: I): GraphTypeInfo {
    const message = createBaseGraphTypeInfo();
    message.schema = object.schema ?? "";
    message.name = object.name ?? "";
    return message;
  },
};

function createBaseListGraphTypesResponse(): ListGraphTypesResponse {
  return { graphTypes: [] };
}

export const ListGraphTypesResponse: MessageFns<ListGraphTypesResponse> = {
  encode(message: ListGraphTypesResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
    for (const v of message.graphTypes) {
      GraphTypeInfo.encode(v!, writer.uint32(10).fork()).join();
    }
    return writer;
  },

  decode(input: BinaryReader | Uint8Array, length?: number): ListGraphTypesResponse {
    const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
    const end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseListGraphTypesResponse();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1: {
          if (tag !== 10) {
            break;
          }

          message.graphTypes.push(GraphTypeInfo.decode(reader, reader.uint32()));
          continue;
        }
      }
      if ((tag & 7) === 4 || tag === 0) {
        break;
      }
      reader.skip(tag & 7);
    }
    return message;
  },

  fromJSON(object: any): ListGraphTypesResponse {
    return {
      graphTypes: globalThis.Array.isArray(object?.graphTypes)
        ? object.graphTypes.map((e: any) => GraphTypeInfo.fromJSON(e))
        : globalThis.Array.isArray(object?.graph_types)
        ? object.graph_types.map((e: any) => GraphTypeInfo.fromJSON(e))
        : [],
    };
  },

  toJSON(message: ListGraphTypesResponse): unknown {
    const obj: any = {};
    if (message.graphTypes?.length) {
      obj.graphTypes = message.graphTypes.map((e) => GraphTypeInfo.toJSON(e));
    }
    return obj;
  },

  create<I extends Exact<DeepPartial<ListGraphTypesResponse>, I>>(base?: I): ListGraphTypesResponse {
    return ListGraphTypesResponse.fromPartial(base ?? ({} as any));
  },
  fromPartial<I extends Exact<DeepPartial<ListGraphTypesResponse>, I>>(object: I): ListGraphTypesResponse {
    const message = createBaseListGraphTypesResponse();
    message.graphTypes = object.graphTypes?.map((e) => GraphTypeInfo.fromPartial(e)) || [];
    return message;
  },
};

function createBaseCreateGraphTypeRequest(): CreateGraphTypeRequest {
  return { schema: "", name: "", ifNotExists: false, orReplace: false };
}

export const CreateGraphTypeRequest: MessageFns<CreateGraphTypeRequest> = {
  encode(message: CreateGraphTypeRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
    if (message.schema !== "") {
      writer.uint32(10).string(message.schema);
    }
    if (message.name !== "") {
      writer.uint32(18).string(message.name);
    }
    if (message.ifNotExists !== false) {
      writer.uint32(24).bool(message.ifNotExists);
    }
    if (message.orReplace !== false) {
      writer.uint32(32).bool(message.orReplace);
    }
    return writer;
  },

  decode(input: BinaryReader | Uint8Array, length?: number): CreateGraphTypeRequest {
    const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
    const end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseCreateGraphTypeRequest();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1: {
          if (tag !== 10) {
            break;
          }

          message.schema = reader.string();
          continue;
        }
        case 2: {
          if (tag !== 18) {
            break;
          }

          message.name = reader.string();
          continue;
        }
        case 3: {
          if (tag !== 24) {
            break;
          }

          message.ifNotExists = reader.bool();
          continue;
        }
        case 4: {
          if (tag !== 32) {
            break;
          }

          message.orReplace = reader.bool();
          continue;
        }
      }
      if ((tag & 7) === 4 || tag === 0) {
        break;
      }
      reader.skip(tag & 7);
    }
    return message;
  },

  fromJSON(object: any): CreateGraphTypeRequest {
    return {
      schema: isSet(object.schema) ? globalThis.String(object.schema) : "",
      name: isSet(object.name) ? globalThis.String(object.name) : "",
      ifNotExists: isSet(object.ifNotExists)
        ? globalThis.Boolean(object.ifNotExists)
        : isSet(object.if_not_exists)
        ? globalThis.Boolean(object.if_not_exists)
        : false,
      orReplace: isSet(object.orReplace)
        ? globalThis.Boolean(object.orReplace)
        : isSet(object.or_replace)
        ? globalThis.Boolean(object.or_replace)
        : false,
    };
  },

  toJSON(message: CreateGraphTypeRequest): unknown {
    const obj: any = {};
    if (message.schema !== "") {
      obj.schema = message.schema;
    }
    if (message.name !== "") {
      obj.name = message.name;
    }
    if (message.ifNotExists !== false) {
      obj.ifNotExists = message.ifNotExists;
    }
    if (message.orReplace !== false) {
      obj.orReplace = message.orReplace;
    }
    return obj;
  },

  create<I extends Exact<DeepPartial<CreateGraphTypeRequest>, I>>(base?: I): CreateGraphTypeRequest {
    return CreateGraphTypeRequest.fromPartial(base ?? ({} as any));
  },
  fromPartial<I extends Exact<DeepPartial<CreateGraphTypeRequest>, I>>(object: I): CreateGraphTypeRequest {
    const message = createBaseCreateGraphTypeRequest();
    message.schema = object.schema ?? "";
    message.name = object.name ?? "";
    message.ifNotExists = object.ifNotExists ?? false;
    message.orReplace = object.orReplace ?? false;
    return message;
  },
};

function createBaseCreateGraphTypeResponse(): CreateGraphTypeResponse {
  return {};
}

export const CreateGraphTypeResponse: MessageFns<CreateGraphTypeResponse> = {
  encode(_: CreateGraphTypeResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
    return writer;
  },

  decode(input: BinaryReader | Uint8Array, length?: number): CreateGraphTypeResponse {
    const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
    const end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseCreateGraphTypeResponse();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
      }
      if ((tag & 7) === 4 || tag === 0) {
        break;
      }
      reader.skip(tag & 7);
    }
    return message;
  },

  fromJSON(_: any): CreateGraphTypeResponse {
    return {};
  },

  toJSON(_: CreateGraphTypeResponse): unknown {
    const obj: any = {};
    return obj;
  },

  create<I extends Exact<DeepPartial<CreateGraphTypeResponse>, I>>(base?: I): CreateGraphTypeResponse {
    return CreateGraphTypeResponse.fromPartial(base ?? ({} as any));
  },
  fromPartial<I extends Exact<DeepPartial<CreateGraphTypeResponse>, I>>(_: I): CreateGraphTypeResponse {
    const message = createBaseCreateGraphTypeResponse();
    return message;
  },
};

function createBaseDropGraphTypeRequest(): DropGraphTypeRequest {
  return { schema: "", name: "", ifExists: false };
}

export const DropGraphTypeRequest: MessageFns<DropGraphTypeRequest> = {
  encode(message: DropGraphTypeRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
    if (message.schema !== "") {
      writer.uint32(10).string(message.schema);
    }
    if (message.name !== "") {
      writer.uint32(18).string(message.name);
    }
    if (message.ifExists !== false) {
      writer.uint32(24).bool(message.ifExists);
    }
    return writer;
  },

  decode(input: BinaryReader | Uint8Array, length?: number): DropGraphTypeRequest {
    const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
    const end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseDropGraphTypeRequest();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1: {
          if (tag !== 10) {
            break;
          }

          message.schema = reader.string();
          continue;
        }
        case 2: {
          if (tag !== 18) {
            break;
          }

          message.name = reader.string();
          continue;
        }
        case 3: {
          if (tag !== 24) {
            break;
          }

          message.ifExists = reader.bool();
          continue;
        }
      }
      if ((tag & 7) === 4 || tag === 0) {
        break;
      }
      reader.skip(tag & 7);
    }
    return message;
  },

  fromJSON(object: any): DropGraphTypeRequest {
    return {
      schema: isSet(object.schema) ? globalThis.String(object.schema) : "",
      name: isSet(object.name) ? globalThis.String(object.name) : "",
      ifExists: isSet(object.ifExists)
        ? globalThis.Boolean(object.ifExists)
        : isSet(object.if_exists)
        ? globalThis.Boolean(object.if_exists)
        : false,
    };
  },

  toJSON(message: DropGraphTypeRequest): unknown {
    const obj: any = {};
    if (message.schema !== "") {
      obj.schema = message.schema;
    }
    if (message.name !== "") {
      obj.name = message.name;
    }
    if (message.ifExists !== false) {
      obj.ifExists = message.ifExists;
    }
    return obj;
  },

  create<I extends Exact<DeepPartial<DropGraphTypeRequest>, I>>(base?: I): DropGraphTypeRequest {
    return DropGraphTypeRequest.fromPartial(base ?? ({} as any));
  },
  fromPartial<I extends Exact<DeepPartial<DropGraphTypeRequest>, I>>(object: I): DropGraphTypeRequest {
    const message = createBaseDropGraphTypeRequest();
    message.schema = object.schema ?? "";
    message.name = object.name ?? "";
    message.ifExists = object.ifExists ?? false;
    return message;
  },
};

function createBaseDropGraphTypeResponse(): DropGraphTypeResponse {
  return { existed: false };
}

export const DropGraphTypeResponse: MessageFns<DropGraphTypeResponse> = {
  encode(message: DropGraphTypeResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
    if (message.existed !== false) {
      writer.uint32(8).bool(message.existed);
    }
    return writer;
  },

  decode(input: BinaryReader | Uint8Array, length?: number): DropGraphTypeResponse {
    const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
    const end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseDropGraphTypeResponse();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1: {
          if (tag !== 8) {
            break;
          }

          message.existed = reader.bool();
          continue;
        }
      }
      if ((tag & 7) === 4 || tag === 0) {
        break;
      }
      reader.skip(tag & 7);
    }
    return message;
  },

  fromJSON(object: any): DropGraphTypeResponse {
    return { existed: isSet(object.existed) ? globalThis.Boolean(object.existed) : false };
  },

  toJSON(message: DropGraphTypeResponse): unknown {
    const obj: any = {};
    if (message.existed !== false) {
      obj.existed = message.existed;
    }
    return obj;
  },

  create<I extends Exact<DeepPartial<DropGraphTypeResponse>, I>>(base?: I): DropGraphTypeResponse {
    return DropGraphTypeResponse.fromPartial(base ?? ({} as any));
  },
  fromPartial<I extends Exact<DeepPartial<DropGraphTypeResponse>, I>>(object: I): DropGraphTypeResponse {
    const message = createBaseDropGraphTypeResponse();
    message.existed = object.existed ?? false;
    return message;
  },
};

function createBaseGetGraphStatsRequest(): GetGraphStatsRequest {
  return { graph: "" };
}

export const GetGraphStatsRequest: MessageFns<GetGraphStatsRequest> = {
  encode(message: GetGraphStatsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
    if (message.graph !== "") {
      writer.uint32(10).string(message.graph);
    }
    return writer;
  },

  decode(input: BinaryReader | Uint8Array, length?: number): GetGraphStatsRequest {
    const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
    const end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseGetGraphStatsRequest();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1: {
          if (tag !== 10) {
            break;
          }

          message.graph = reader.string();
          continue;
        }
      }
      if ((tag & 7) === 4 || tag === 0) {
        break;
      }
      reader.skip(tag & 7);
    }
    return message;
  },

  fromJSON(object: any): GetGraphStatsRequest {
    return { graph: isSet(object.graph) ? globalThis.String(object.graph) : "" };
  },

  toJSON(message: GetGraphStatsRequest): unknown {
    const obj: any = {};
    if (message.graph !== "") {
      obj.graph = message.graph;
    }
    return obj;
  },

  create<I extends Exact<DeepPartial<GetGraphStatsRequest>, I>>(base?: I): GetGraphStatsRequest {
    return GetGraphStatsRequest.fromPartial(base ?? ({} as any));
  },
  fromPartial<I extends Exact<DeepPartial<GetGraphStatsRequest>, I>>(object: I): GetGraphStatsRequest {
    const message = createBaseGetGraphStatsRequest();
    message.graph = object.graph ?? "";
    return message;
  },
};

function createBaseGetGraphStatsResponse(): GetGraphStatsResponse {
  return {
    nodeCount: 0n,
    edgeCount: 0n,
    labelCount: 0n,
    edgeTypeCount: 0n,
    propertyKeyCount: 0n,
    indexCount: 0n,
    memoryBytes: 0n,
    diskBytes: undefined,
  };
}

export const GetGraphStatsResponse: MessageFns<GetGraphStatsResponse> = {
  encode(message: GetGraphStatsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
    if (message.nodeCount !== 0n) {
      if (BigInt.asUintN(64, message.nodeCount) !== message.nodeCount) {
        throw new globalThis.Error("value provided for field message.nodeCount of type uint64 too large");
      }
      writer.uint32(8).uint64(message.nodeCount);
    }
    if (message.edgeCount !== 0n) {
      if (BigInt.asUintN(64, message.edgeCount) !== message.edgeCount) {
        throw new globalThis.Error("value provided for field message.edgeCount of type uint64 too large");
      }
      writer.uint32(16).uint64(message.edgeCount);
    }
    if (message.labelCount !== 0n) {
      if (BigInt.asUintN(64, message.labelCount) !== message.labelCount) {
        throw new globalThis.Error("value provided for field message.labelCount of type uint64 too large");
      }
      writer.uint32(24).uint64(message.labelCount);
    }
    if (message.edgeTypeCount !== 0n) {
      if (BigInt.asUintN(64, message.edgeTypeCount) !== message.edgeTypeCount) {
        throw new globalThis.Error("value provided for field message.edgeTypeCount of type uint64 too large");
      }
      writer.uint32(32).uint64(message.edgeTypeCount);
    }
    if (message.propertyKeyCount !== 0n) {
      if (BigInt.asUintN(64, message.propertyKeyCount) !== message.propertyKeyCount) {
        throw new globalThis.Error("value provided for field message.propertyKeyCount of type uint64 too large");
      }
      writer.uint32(40).uint64(message.propertyKeyCount);
    }
    if (message.indexCount !== 0n) {
      if (BigInt.asUintN(64, message.indexCount) !== message.indexCount) {
        throw new globalThis.Error("value provided for field message.indexCount of type uint64 too large");
      }
      writer.uint32(48).uint64(message.indexCount);
    }
    if (message.memoryBytes !== 0n) {
      if (BigInt.asUintN(64, message.memoryBytes) !== message.memoryBytes) {
        throw new globalThis.Error("value provided for field message.memoryBytes of type uint64 too large");
      }
      writer.uint32(56).uint64(message.memoryBytes);
    }
    if (message.diskBytes !== undefined) {
      if (BigInt.asUintN(64, message.diskBytes) !== message.diskBytes) {
        throw new globalThis.Error("value provided for field message.diskBytes of type uint64 too large");
      }
      writer.uint32(64).uint64(message.diskBytes);
    }
    return writer;
  },

  decode(input: BinaryReader | Uint8Array, length?: number): GetGraphStatsResponse {
    const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
    const end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseGetGraphStatsResponse();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1: {
          if (tag !== 8) {
            break;
          }

          message.nodeCount = reader.uint64() as bigint;
          continue;
        }
        case 2: {
          if (tag !== 16) {
            break;
          }

          message.edgeCount = reader.uint64() as bigint;
          continue;
        }
        case 3: {
          if (tag !== 24) {
            break;
          }

          message.labelCount = reader.uint64() as bigint;
          continue;
        }
        case 4: {
          if (tag !== 32) {
            break;
          }

          message.edgeTypeCount = reader.uint64() as bigint;
          continue;
        }
        case 5: {
          if (tag !== 40) {
            break;
          }

          message.propertyKeyCount = reader.uint64() as bigint;
          continue;
        }
        case 6: {
          if (tag !== 48) {
            break;
          }

          message.indexCount = reader.uint64() as bigint;
          continue;
        }
        case 7: {
          if (tag !== 56) {
            break;
          }

          message.memoryBytes = reader.uint64() as bigint;
          continue;
        }
        case 8: {
          if (tag !== 64) {
            break;
          }

          message.diskBytes = reader.uint64() as bigint;
          continue;
        }
      }
      if ((tag & 7) === 4 || tag === 0) {
        break;
      }
      reader.skip(tag & 7);
    }
    return message;
  },

  fromJSON(object: any): GetGraphStatsResponse {
    return {
      nodeCount: isSet(object.nodeCount)
        ? BigInt(object.nodeCount)
        : isSet(object.node_count)
        ? BigInt(object.node_count)
        : 0n,
      edgeCount: isSet(object.edgeCount)
        ? BigInt(object.edgeCount)
        : isSet(object.edge_count)
        ? BigInt(object.edge_count)
        : 0n,
      labelCount: isSet(object.labelCount)
        ? BigInt(object.labelCount)
        : isSet(object.label_count)
        ? BigInt(object.label_count)
        : 0n,
      edgeTypeCount: isSet(object.edgeTypeCount)
        ? BigInt(object.edgeTypeCount)
        : isSet(object.edge_type_count)
        ? BigInt(object.edge_type_count)
        : 0n,
      propertyKeyCount: isSet(object.propertyKeyCount)
        ? BigInt(object.propertyKeyCount)
        : isSet(object.property_key_count)
        ? BigInt(object.property_key_count)
        : 0n,
      indexCount: isSet(object.indexCount)
        ? BigInt(object.indexCount)
        : isSet(object.index_count)
        ? BigInt(object.index_count)
        : 0n,
      memoryBytes: isSet(object.memoryBytes)
        ? BigInt(object.memoryBytes)
        : isSet(object.memory_bytes)
        ? BigInt(object.memory_bytes)
        : 0n,
      diskBytes: isSet(object.diskBytes)
        ? BigInt(object.diskBytes)
        : isSet(object.disk_bytes)
        ? BigInt(object.disk_bytes)
        : undefined,
    };
  },

  toJSON(message: GetGraphStatsResponse): unknown {
    const obj: any = {};
    if (message.nodeCount !== 0n) {
      obj.nodeCount = message.nodeCount.toString();
    }
    if (message.edgeCount !== 0n) {
      obj.edgeCount = message.edgeCount.toString();
    }
    if (message.labelCount !== 0n) {
      obj.labelCount = message.labelCount.toString();
    }
    if (message.edgeTypeCount !== 0n) {
      obj.edgeTypeCount = message.edgeTypeCount.toString();
    }
    if (message.propertyKeyCount !== 0n) {
      obj.propertyKeyCount = message.propertyKeyCount.toString();
    }
    if (message.indexCount !== 0n) {
      obj.indexCount = message.indexCount.toString();
    }
    if (message.memoryBytes !== 0n) {
      obj.memoryBytes = message.memoryBytes.toString();
    }
    if (message.diskBytes !== undefined) {
      obj.diskBytes = message.diskBytes.toString();
    }
    return obj;
  },

  create<I extends Exact<DeepPartial<GetGraphStatsResponse>, I>>(base?: I): GetGraphStatsResponse {
    return GetGraphStatsResponse.fromPartial(base ?? ({} as any));
  },
  fromPartial<I extends Exact<DeepPartial<GetGraphStatsResponse>, I>>(object: I): GetGraphStatsResponse {
    const message = createBaseGetGraphStatsResponse();
    message.nodeCount = object.nodeCount ?? 0n;
    message.edgeCount = object.edgeCount ?? 0n;
    message.labelCount = object.labelCount ?? 0n;
    message.edgeTypeCount = object.edgeTypeCount ?? 0n;
    message.propertyKeyCount = object.propertyKeyCount ?? 0n;
    message.indexCount = object.indexCount ?? 0n;
    message.memoryBytes = object.memoryBytes ?? 0n;
    message.diskBytes = object.diskBytes ?? undefined;
    return message;
  },
};

function createBaseWalStatusRequest(): WalStatusRequest {
  return { graph: "" };
}

export const WalStatusRequest: MessageFns<WalStatusRequest> = {
  encode(message: WalStatusRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
    if (message.graph !== "") {
      writer.uint32(10).string(message.graph);
    }
    return writer;
  },

  decode(input: BinaryReader | Uint8Array, length?: number): WalStatusRequest {
    const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
    const end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseWalStatusRequest();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1: {
          if (tag !== 10) {
            break;
          }

          message.graph = reader.string();
          continue;
        }
      }
      if ((tag & 7) === 4 || tag === 0) {
        break;
      }
      reader.skip(tag & 7);
    }
    return message;
  },

  fromJSON(object: any): WalStatusRequest {
    return { graph: isSet(object.graph) ? globalThis.String(object.graph) : "" };
  },

  toJSON(message: WalStatusRequest): unknown {
    const obj: any = {};
    if (message.graph !== "") {
      obj.graph = message.graph;
    }
    return obj;
  },

  create<I extends Exact<DeepPartial<WalStatusRequest>, I>>(base?: I): WalStatusRequest {
    return WalStatusRequest.fromPartial(base ?? ({} as any));
  },
  fromPartial<I extends Exact<DeepPartial<WalStatusRequest>, I>>(object: I): WalStatusRequest {
    const message = createBaseWalStatusRequest();
    message.graph = object.graph ?? "";
    return message;
  },
};

function createBaseWalStatusResponse(): WalStatusResponse {
  return {
    enabled: false,
    path: undefined,
    sizeBytes: 0n,
    recordCount: 0n,
    lastCheckpoint: undefined,
    currentEpoch: 0n,
  };
}

export const WalStatusResponse: MessageFns<WalStatusResponse> = {
  encode(message: WalStatusResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
    if (message.enabled !== false) {
      writer.uint32(8).bool(message.enabled);
    }
    if (message.path !== undefined) {
      writer.uint32(18).string(message.path);
    }
    if (message.sizeBytes !== 0n) {
      if (BigInt.asUintN(64, message.sizeBytes) !== message.sizeBytes) {
        throw new globalThis.Error("value provided for field message.sizeBytes of type uint64 too large");
      }
      writer.uint32(24).uint64(message.sizeBytes);
    }
    if (message.recordCount !== 0n) {
      if (BigInt.asUintN(64, message.recordCount) !== message.recordCount) {
        throw new globalThis.Error("value provided for field message.recordCount of type uint64 too large");
      }
      writer.uint32(32).uint64(message.recordCount);
    }
    if (message.lastCheckpoint !== undefined) {
      if (BigInt.asUintN(64, message.lastCheckpoint) !== message.lastCheckpoint) {
        throw new globalThis.Error("value provided for field message.lastCheckpoint of type uint64 too large");
      }
      writer.uint32(40).uint64(message.lastCheckpoint);
    }
    if (message.currentEpoch !== 0n) {
      if (BigInt.asUintN(64, message.currentEpoch) !== message.currentEpoch) {
        throw new globalThis.Error("value provided for field message.currentEpoch of type uint64 too large");
      }
      writer.uint32(48).uint64(message.currentEpoch);
    }
    return writer;
  },

  decode(input: BinaryReader | Uint8Array, length?: number): WalStatusResponse {
    const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
    const end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseWalStatusResponse();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1: {
          if (tag !== 8) {
            break;
          }

          message.enabled = reader.bool();
          continue;
        }
        case 2: {
          if (tag !== 18) {
            break;
          }

          message.path = reader.string();
          continue;
        }
        case 3: {
          if (tag !== 24) {
            break;
          }

          message.sizeBytes = reader.uint64() as bigint;
          continue;
        }
        case 4: {
          if (tag !== 32) {
            break;
          }

          message.recordCount = reader.uint64() as bigint;
          continue;
        }
        case 5: {
          if (tag !== 40) {
            break;
          }

          message.lastCheckpoint = reader.uint64() as bigint;
          continue;
        }
        case 6: {
          if (tag !== 48) {
            break;
          }

          message.currentEpoch = reader.uint64() as bigint;
          continue;
        }
      }
      if ((tag & 7) === 4 || tag === 0) {
        break;
      }
      reader.skip(tag & 7);
    }
    return message;
  },

  fromJSON(object: any): WalStatusResponse {
    return {
      enabled: isSet(object.enabled) ? globalThis.Boolean(object.enabled) : false,
      path: isSet(object.path) ? globalThis.String(object.path) : undefined,
      sizeBytes: isSet(object.sizeBytes)
        ? BigInt(object.sizeBytes)
        : isSet(object.size_bytes)
        ? BigInt(object.size_bytes)
        : 0n,
      recordCount: isSet(object.recordCount)
        ? BigInt(object.recordCount)
        : isSet(object.record_count)
        ? BigInt(object.record_count)
        : 0n,
      lastCheckpoint: isSet(object.lastCheckpoint)
        ? BigInt(object.lastCheckpoint)
        : isSet(object.last_checkpoint)
        ? BigInt(object.last_checkpoint)
        : undefined,
      currentEpoch: isSet(object.currentEpoch)
        ? BigInt(object.currentEpoch)
        : isSet(object.current_epoch)
        ? BigInt(object.current_epoch)
        : 0n,
    };
  },

  toJSON(message: WalStatusResponse): unknown {
    const obj: any = {};
    if (message.enabled !== false) {
      obj.enabled = message.enabled;
    }
    if (message.path !== undefined) {
      obj.path = message.path;
    }
    if (message.sizeBytes !== 0n) {
      obj.sizeBytes = message.sizeBytes.toString();
    }
    if (message.recordCount !== 0n) {
      obj.recordCount = message.recordCount.toString();
    }
    if (message.lastCheckpoint !== undefined) {
      obj.lastCheckpoint = message.lastCheckpoint.toString();
    }
    if (message.currentEpoch !== 0n) {
      obj.currentEpoch = message.currentEpoch.toString();
    }
    return obj;
  },

  create<I extends Exact<DeepPartial<WalStatusResponse>, I>>(base?: I): WalStatusResponse {
    return WalStatusResponse.fromPartial(base ?? ({} as any));
  },
  fromPartial<I extends Exact<DeepPartial<WalStatusResponse>, I>>(object: I): WalStatusResponse {
    const message = createBaseWalStatusResponse();
    message.enabled = object.enabled ?? false;
    message.path = object.path ?? undefined;
    message.sizeBytes = object.sizeBytes ?? 0n;
    message.recordCount = object.recordCount ?? 0n;
    message.lastCheckpoint = object.lastCheckpoint ?? undefined;
    message.currentEpoch = object.currentEpoch ?? 0n;
    return message;
  },
};

function createBaseWalCheckpointRequest(): WalCheckpointRequest {
  return { graph: "" };
}

export const WalCheckpointRequest: MessageFns<WalCheckpointRequest> = {
  encode(message: WalCheckpointRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
    if (message.graph !== "") {
      writer.uint32(10).string(message.graph);
    }
    return writer;
  },

  decode(input: BinaryReader | Uint8Array, length?: number): WalCheckpointRequest {
    const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
    const end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseWalCheckpointRequest();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1: {
          if (tag !== 10) {
            break;
          }

          message.graph = reader.string();
          continue;
        }
      }
      if ((tag & 7) === 4 || tag === 0) {
        break;
      }
      reader.skip(tag & 7);
    }
    return message;
  },

  fromJSON(object: any): WalCheckpointRequest {
    return { graph: isSet(object.graph) ? globalThis.String(object.graph) : "" };
  },

  toJSON(message: WalCheckpointRequest): unknown {
    const obj: any = {};
    if (message.graph !== "") {
      obj.graph = message.graph;
    }
    return obj;
  },

  create<I extends Exact<DeepPartial<WalCheckpointRequest>, I>>(base?: I): WalCheckpointRequest {
    return WalCheckpointRequest.fromPartial(base ?? ({} as any));
  },
  fromPartial<I extends Exact<DeepPartial<WalCheckpointRequest>, I>>(object: I): WalCheckpointRequest {
    const message = createBaseWalCheckpointRequest();
    message.graph = object.graph ?? "";
    return message;
  },
};

function createBaseWalCheckpointResponse(): WalCheckpointResponse {
  return {};
}

export const WalCheckpointResponse: MessageFns<WalCheckpointResponse> = {
  encode(_: WalCheckpointResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
    return writer;
  },

  decode(input: BinaryReader | Uint8Array, length?: number): WalCheckpointResponse {
    const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
    const end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseWalCheckpointResponse();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
      }
      if ((tag & 7) === 4 || tag === 0) {
        break;
      }
      reader.skip(tag & 7);
    }
    return message;
  },

  fromJSON(_: any): WalCheckpointResponse {
    return {};
  },

  toJSON(_: WalCheckpointResponse): unknown {
    const obj: any = {};
    return obj;
  },

  create<I extends Exact<DeepPartial<WalCheckpointResponse>, I>>(base?: I): WalCheckpointResponse {
    return WalCheckpointResponse.fromPartial(base ?? ({} as any));
  },
  fromPartial<I extends Exact<DeepPartial<WalCheckpointResponse>, I>>(_: I): WalCheckpointResponse {
    const message = createBaseWalCheckpointResponse();
    return message;
  },
};

function createBaseValidateRequest(): ValidateRequest {
  return { graph: "" };
}

export const ValidateRequest: MessageFns<ValidateRequest> = {
  encode(message: ValidateRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
    if (message.graph !== "") {
      writer.uint32(10).string(message.graph);
    }
    return writer;
  },

  decode(input: BinaryReader | Uint8Array, length?: number): ValidateRequest {
    const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
    const end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseValidateRequest();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1: {
          if (tag !== 10) {
            break;
          }

          message.graph = reader.string();
          continue;
        }
      }
      if ((tag & 7) === 4 || tag === 0) {
        break;
      }
      reader.skip(tag & 7);
    }
    return message;
  },

  fromJSON(object: any): ValidateRequest {
    return { graph: isSet(object.graph) ? globalThis.String(object.graph) : "" };
  },

  toJSON(message: ValidateRequest): unknown {
    const obj: any = {};
    if (message.graph !== "") {
      obj.graph = message.graph;
    }
    return obj;
  },

  create<I extends Exact<DeepPartial<ValidateRequest>, I>>(base?: I): ValidateRequest {
    return ValidateRequest.fromPartial(base ?? ({} as any));
  },
  fromPartial<I extends Exact<DeepPartial<ValidateRequest>, I>>(object: I): ValidateRequest {
    const message = createBaseValidateRequest();
    message.graph = object.graph ?? "";
    return message;
  },
};

function createBaseValidateResponse(): ValidateResponse {
  return { valid: false, errors: [], warnings: [] };
}

export const ValidateResponse: MessageFns<ValidateResponse> = {
  encode(message: ValidateResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
    if (message.valid !== false) {
      writer.uint32(8).bool(message.valid);
    }
    for (const v of message.errors) {
      ValidationError.encode(v!, writer.uint32(18).fork()).join();
    }
    for (const v of message.warnings) {
      ValidationWarning.encode(v!, writer.uint32(26).fork()).join();
    }
    return writer;
  },

  decode(input: BinaryReader | Uint8Array, length?: number): ValidateResponse {
    const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
    const end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseValidateResponse();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1: {
          if (tag !== 8) {
            break;
          }

          message.valid = reader.bool();
          continue;
        }
        case 2: {
          if (tag !== 18) {
            break;
          }

          message.errors.push(ValidationError.decode(reader, reader.uint32()));
          continue;
        }
        case 3: {
          if (tag !== 26) {
            break;
          }

          message.warnings.push(ValidationWarning.decode(reader, reader.uint32()));
          continue;
        }
      }
      if ((tag & 7) === 4 || tag === 0) {
        break;
      }
      reader.skip(tag & 7);
    }
    return message;
  },

  fromJSON(object: any): ValidateResponse {
    return {
      valid: isSet(object.valid) ? globalThis.Boolean(object.valid) : false,
      errors: globalThis.Array.isArray(object?.errors)
        ? object.errors.map((e: any) => ValidationError.fromJSON(e))
        : [],
      warnings: globalThis.Array.isArray(object?.warnings)
        ? object.warnings.map((e: any) => ValidationWarning.fromJSON(e))
        : [],
    };
  },

  toJSON(message: ValidateResponse): unknown {
    const obj: any = {};
    if (message.valid !== false) {
      obj.valid = message.valid;
    }
    if (message.errors?.length) {
      obj.errors = message.errors.map((e) => ValidationError.toJSON(e));
    }
    if (message.warnings?.length) {
      obj.warnings = message.warnings.map((e) => ValidationWarning.toJSON(e));
    }
    return obj;
  },

  create<I extends Exact<DeepPartial<ValidateResponse>, I>>(base?: I): ValidateResponse {
    return ValidateResponse.fromPartial(base ?? ({} as any));
  },
  fromPartial<I extends Exact<DeepPartial<ValidateResponse>, I>>(object: I): ValidateResponse {
    const message = createBaseValidateResponse();
    message.valid = object.valid ?? false;
    message.errors = object.errors?.map((e) => ValidationError.fromPartial(e)) || [];
    message.warnings = object.warnings?.map((e) => ValidationWarning.fromPartial(e)) || [];
    return message;
  },
};

function createBaseValidationError(): ValidationError {
  return { code: "", message: "", context: undefined };
}

export const ValidationError: MessageFns<ValidationError> = {
  encode(message: ValidationError, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
    if (message.code !== "") {
      writer.uint32(10).string(message.code);
    }
    if (message.message !== "") {
      writer.uint32(18).string(message.message);
    }
    if (message.context !== undefined) {
      writer.uint32(26).string(message.context);
    }
    return writer;
  },

  decode(input: BinaryReader | Uint8Array, length?: number): ValidationError {
    const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
    const end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseValidationError();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1: {
          if (tag !== 10) {
            break;
          }

          message.code = reader.string();
          continue;
        }
        case 2: {
          if (tag !== 18) {
            break;
          }

          message.message = reader.string();
          continue;
        }
        case 3: {
          if (tag !== 26) {
            break;
          }

          message.context = reader.string();
          continue;
        }
      }
      if ((tag & 7) === 4 || tag === 0) {
        break;
      }
      reader.skip(tag & 7);
    }
    return message;
  },

  fromJSON(object: any): ValidationError {
    return {
      code: isSet(object.code) ? globalThis.String(object.code) : "",
      message: isSet(object.message) ? globalThis.String(object.message) : "",
      context: isSet(object.context) ? globalThis.String(object.context) : undefined,
    };
  },

  toJSON(message: ValidationError): unknown {
    const obj: any = {};
    if (message.code !== "") {
      obj.code = message.code;
    }
    if (message.message !== "") {
      obj.message = message.message;
    }
    if (message.context !== undefined) {
      obj.context = message.context;
    }
    return obj;
  },

  create<I extends Exact<DeepPartial<ValidationError>, I>>(base?: I): ValidationError {
    return ValidationError.fromPartial(base ?? ({} as any));
  },
  fromPartial<I extends Exact<DeepPartial<ValidationError>, I>>(object: I): ValidationError {
    const message = createBaseValidationError();
    message.code = object.code ?? "";
    message.message = object.message ?? "";
    message.context = object.context ?? undefined;
    return message;
  },
};

function createBaseValidationWarning(): ValidationWarning {
  return { code: "", message: "", context: undefined };
}

export const ValidationWarning: MessageFns<ValidationWarning> = {
  encode(message: ValidationWarning, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
    if (message.code !== "") {
      writer.uint32(10).string(message.code);
    }
    if (message.message !== "") {
      writer.uint32(18).string(message.message);
    }
    if (message.context !== undefined) {
      writer.uint32(26).string(message.context);
    }
    return writer;
  },

  decode(input: BinaryReader | Uint8Array, length?: number): ValidationWarning {
    const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
    const end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseValidationWarning();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1: {
          if (tag !== 10) {
            break;
          }

          message.code = reader.string();
          continue;
        }
        case 2: {
          if (tag !== 18) {
            break;
          }

          message.message = reader.string();
          continue;
        }
        case 3: {
          if (tag !== 26) {
            break;
          }

          message.context = reader.string();
          continue;
        }
      }
      if ((tag & 7) === 4 || tag === 0) {
        break;
      }
      reader.skip(tag & 7);
    }
    return message;
  },

  fromJSON(object: any): ValidationWarning {
    return {
      code: isSet(object.code) ? globalThis.String(object.code) : "",
      message: isSet(object.message) ? globalThis.String(object.message) : "",
      context: isSet(object.context) ? globalThis.String(object.context) : undefined,
    };
  },

  toJSON(message: ValidationWarning): unknown {
    const obj: any = {};
    if (message.code !== "") {
      obj.code = message.code;
    }
    if (message.message !== "") {
      obj.message = message.message;
    }
    if (message.context !== undefined) {
      obj.context = message.context;
    }
    return obj;
  },

  create<I extends Exact<DeepPartial<ValidationWarning>, I>>(base?: I): ValidationWarning {
    return ValidationWarning.fromPartial(base ?? ({} as any));
  },
  fromPartial<I extends Exact<DeepPartial<ValidationWarning>, I>>(object: I): ValidationWarning {
    const message = createBaseValidationWarning();
    message.code = object.code ?? "";
    message.message = object.message ?? "";
    message.context = object.context ?? undefined;
    return message;
  },
};

function createBaseCreateIndexRequest(): CreateIndexRequest {
  return { graph: "", propertyIndex: undefined, vectorIndex: undefined, textIndex: undefined };
}

export const CreateIndexRequest: MessageFns<CreateIndexRequest> = {
  encode(message: CreateIndexRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
    if (message.graph !== "") {
      writer.uint32(10).string(message.graph);
    }
    if (message.propertyIndex !== undefined) {
      PropertyIndexDef.encode(message.propertyIndex, writer.uint32(18).fork()).join();
    }
    if (message.vectorIndex !== undefined) {
      VectorIndexDef.encode(message.vectorIndex, writer.uint32(26).fork()).join();
    }
    if (message.textIndex !== undefined) {
      TextIndexDef.encode(message.textIndex, writer.uint32(34).fork()).join();
    }
    return writer;
  },

  decode(input: BinaryReader | Uint8Array, length?: number): CreateIndexRequest {
    const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
    const end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseCreateIndexRequest();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1: {
          if (tag !== 10) {
            break;
          }

          message.graph = reader.string();
          continue;
        }
        case 2: {
          if (tag !== 18) {
            break;
          }

          message.propertyIndex = PropertyIndexDef.decode(reader, reader.uint32());
          continue;
        }
        case 3: {
          if (tag !== 26) {
            break;
          }

          message.vectorIndex = VectorIndexDef.decode(reader, reader.uint32());
          continue;
        }
        case 4: {
          if (tag !== 34) {
            break;
          }

          message.textIndex = TextIndexDef.decode(reader, reader.uint32());
          continue;
        }
      }
      if ((tag & 7) === 4 || tag === 0) {
        break;
      }
      reader.skip(tag & 7);
    }
    return message;
  },

  fromJSON(object: any): CreateIndexRequest {
    return {
      graph: isSet(object.graph) ? globalThis.String(object.graph) : "",
      propertyIndex: isSet(object.propertyIndex)
        ? PropertyIndexDef.fromJSON(object.propertyIndex)
        : isSet(object.property_index)
        ? PropertyIndexDef.fromJSON(object.property_index)
        : undefined,
      vectorIndex: isSet(object.vectorIndex)
        ? VectorIndexDef.fromJSON(object.vectorIndex)
        : isSet(object.vector_index)
        ? VectorIndexDef.fromJSON(object.vector_index)
        : undefined,
      textIndex: isSet(object.textIndex)
        ? TextIndexDef.fromJSON(object.textIndex)
        : isSet(object.text_index)
        ? TextIndexDef.fromJSON(object.text_index)
        : undefined,
    };
  },

  toJSON(message: CreateIndexRequest): unknown {
    const obj: any = {};
    if (message.graph !== "") {
      obj.graph = message.graph;
    }
    if (message.propertyIndex !== undefined) {
      obj.propertyIndex = PropertyIndexDef.toJSON(message.propertyIndex);
    }
    if (message.vectorIndex !== undefined) {
      obj.vectorIndex = VectorIndexDef.toJSON(message.vectorIndex);
    }
    if (message.textIndex !== undefined) {
      obj.textIndex = TextIndexDef.toJSON(message.textIndex);
    }
    return obj;
  },

  create<I extends Exact<DeepPartial<CreateIndexRequest>, I>>(base?: I): CreateIndexRequest {
    return CreateIndexRequest.fromPartial(base ?? ({} as any));
  },
  fromPartial<I extends Exact<DeepPartial<CreateIndexRequest>, I>>(object: I): CreateIndexRequest {
    const message = createBaseCreateIndexRequest();
    message.graph = object.graph ?? "";
    message.propertyIndex = (object.propertyIndex !== undefined && object.propertyIndex !== null)
      ? PropertyIndexDef.fromPartial(object.propertyIndex)
      : undefined;
    message.vectorIndex = (object.vectorIndex !== undefined && object.vectorIndex !== null)
      ? VectorIndexDef.fromPartial(object.vectorIndex)
      : undefined;
    message.textIndex = (object.textIndex !== undefined && object.textIndex !== null)
      ? TextIndexDef.fromPartial(object.textIndex)
      : undefined;
    return message;
  },
};

function createBasePropertyIndexDef(): PropertyIndexDef {
  return { property: "" };
}

export const PropertyIndexDef: MessageFns<PropertyIndexDef> = {
  encode(message: PropertyIndexDef, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
    if (message.property !== "") {
      writer.uint32(10).string(message.property);
    }
    return writer;
  },

  decode(input: BinaryReader | Uint8Array, length?: number): PropertyIndexDef {
    const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
    const end = length === undefined ? reader.len : reader.pos + length;
    const message = createBasePropertyIndexDef();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1: {
          if (tag !== 10) {
            break;
          }

          message.property = reader.string();
          continue;
        }
      }
      if ((tag & 7) === 4 || tag === 0) {
        break;
      }
      reader.skip(tag & 7);
    }
    return message;
  },

  fromJSON(object: any): PropertyIndexDef {
    return { property: isSet(object.property) ? globalThis.String(object.property) : "" };
  },

  toJSON(message: PropertyIndexDef): unknown {
    const obj: any = {};
    if (message.property !== "") {
      obj.property = message.property;
    }
    return obj;
  },

  create<I extends Exact<DeepPartial<PropertyIndexDef>, I>>(base?: I): PropertyIndexDef {
    return PropertyIndexDef.fromPartial(base ?? ({} as any));
  },
  fromPartial<I extends Exact<DeepPartial<PropertyIndexDef>, I>>(object: I): PropertyIndexDef {
    const message = createBasePropertyIndexDef();
    message.property = object.property ?? "";
    return message;
  },
};

function createBaseVectorIndexDef(): VectorIndexDef {
  return { label: "", property: "", dimensions: undefined, metric: undefined, m: undefined, efConstruction: undefined };
}

export const VectorIndexDef: MessageFns<VectorIndexDef> = {
  encode(message: VectorIndexDef, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
    if (message.label !== "") {
      writer.uint32(10).string(message.label);
    }
    if (message.property !== "") {
      writer.uint32(18).string(message.property);
    }
    if (message.dimensions !== undefined) {
      writer.uint32(24).uint32(message.dimensions);
    }
    if (message.metric !== undefined) {
      writer.uint32(34).string(message.metric);
    }
    if (message.m !== undefined) {
      writer.uint32(40).uint32(message.m);
    }
    if (message.efConstruction !== undefined) {
      writer.uint32(48).uint32(message.efConstruction);
    }
    return writer;
  },

  decode(input: BinaryReader | Uint8Array, length?: number): VectorIndexDef {
    const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
    const end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseVectorIndexDef();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1: {
          if (tag !== 10) {
            break;
          }

          message.label = reader.string();
          continue;
        }
        case 2: {
          if (tag !== 18) {
            break;
          }

          message.property = reader.string();
          continue;
        }
        case 3: {
          if (tag !== 24) {
            break;
          }

          message.dimensions = reader.uint32();
          continue;
        }
        case 4: {
          if (tag !== 34) {
            break;
          }

          message.metric = reader.string();
          continue;
        }
        case 5: {
          if (tag !== 40) {
            break;
          }

          message.m = reader.uint32();
          continue;
        }
        case 6: {
          if (tag !== 48) {
            break;
          }

          message.efConstruction = reader.uint32();
          continue;
        }
      }
      if ((tag & 7) === 4 || tag === 0) {
        break;
      }
      reader.skip(tag & 7);
    }
    return message;
  },

  fromJSON(object: any): VectorIndexDef {
    return {
      label: isSet(object.label) ? globalThis.String(object.label) : "",
      property: isSet(object.property) ? globalThis.String(object.property) : "",
      dimensions: isSet(object.dimensions) ? globalThis.Number(object.dimensions) : undefined,
      metric: isSet(object.metric) ? globalThis.String(object.metric) : undefined,
      m: isSet(object.m) ? globalThis.Number(object.m) : undefined,
      efConstruction: isSet(object.efConstruction)
        ? globalThis.Number(object.efConstruction)
        : isSet(object.ef_construction)
        ? globalThis.Number(object.ef_construction)
        : undefined,
    };
  },

  toJSON(message: VectorIndexDef): unknown {
    const obj: any = {};
    if (message.label !== "") {
      obj.label = message.label;
    }
    if (message.property !== "") {
      obj.property = message.property;
    }
    if (message.dimensions !== undefined) {
      obj.dimensions = Math.round(message.dimensions);
    }
    if (message.metric !== undefined) {
      obj.metric = message.metric;
    }
    if (message.m !== undefined) {
      obj.m = Math.round(message.m);
    }
    if (message.efConstruction !== undefined) {
      obj.efConstruction = Math.round(message.efConstruction);
    }
    return obj;
  },

  create<I extends Exact<DeepPartial<VectorIndexDef>, I>>(base?: I): VectorIndexDef {
    return VectorIndexDef.fromPartial(base ?? ({} as any));
  },
  fromPartial<I extends Exact<DeepPartial<VectorIndexDef>, I>>(object: I): VectorIndexDef {
    const message = createBaseVectorIndexDef();
    message.label = object.label ?? "";
    message.property = object.property ?? "";
    message.dimensions = object.dimensions ?? undefined;
    message.metric = object.metric ?? undefined;
    message.m = object.m ?? undefined;
    message.efConstruction = object.efConstruction ?? undefined;
    return message;
  },
};

function createBaseTextIndexDef(): TextIndexDef {
  return { label: "", property: "" };
}

export const TextIndexDef: MessageFns<TextIndexDef> = {
  encode(message: TextIndexDef, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
    if (message.label !== "") {
      writer.uint32(10).string(message.label);
    }
    if (message.property !== "") {
      writer.uint32(18).string(message.property);
    }
    return writer;
  },

  decode(input: BinaryReader | Uint8Array, length?: number): TextIndexDef {
    const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
    const end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseTextIndexDef();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1: {
          if (tag !== 10) {
            break;
          }

          message.label = reader.string();
          continue;
        }
        case 2: {
          if (tag !== 18) {
            break;
          }

          message.property = reader.string();
          continue;
        }
      }
      if ((tag & 7) === 4 || tag === 0) {
        break;
      }
      reader.skip(tag & 7);
    }
    return message;
  },

  fromJSON(object: any): TextIndexDef {
    return {
      label: isSet(object.label) ? globalThis.String(object.label) : "",
      property: isSet(object.property) ? globalThis.String(object.property) : "",
    };
  },

  toJSON(message: TextIndexDef): unknown {
    const obj: any = {};
    if (message.label !== "") {
      obj.label = message.label;
    }
    if (message.property !== "") {
      obj.property = message.property;
    }
    return obj;
  },

  create<I extends Exact<DeepPartial<TextIndexDef>, I>>(base?: I): TextIndexDef {
    return TextIndexDef.fromPartial(base ?? ({} as any));
  },
  fromPartial<I extends Exact<DeepPartial<TextIndexDef>, I>>(object: I): TextIndexDef {
    const message = createBaseTextIndexDef();
    message.label = object.label ?? "";
    message.property = object.property ?? "";
    return message;
  },
};

function createBaseCreateIndexResponse(): CreateIndexResponse {
  return {};
}

export const CreateIndexResponse: MessageFns<CreateIndexResponse> = {
  encode(_: CreateIndexResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
    return writer;
  },

  decode(input: BinaryReader | Uint8Array, length?: number): CreateIndexResponse {
    const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
    const end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseCreateIndexResponse();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
      }
      if ((tag & 7) === 4 || tag === 0) {
        break;
      }
      reader.skip(tag & 7);
    }
    return message;
  },

  fromJSON(_: any): CreateIndexResponse {
    return {};
  },

  toJSON(_: CreateIndexResponse): unknown {
    const obj: any = {};
    return obj;
  },

  create<I extends Exact<DeepPartial<CreateIndexResponse>, I>>(base?: I): CreateIndexResponse {
    return CreateIndexResponse.fromPartial(base ?? ({} as any));
  },
  fromPartial<I extends Exact<DeepPartial<CreateIndexResponse>, I>>(_: I): CreateIndexResponse {
    const message = createBaseCreateIndexResponse();
    return message;
  },
};

function createBaseDropIndexRequest(): DropIndexRequest {
  return { graph: "", propertyIndex: undefined, vectorIndex: undefined, textIndex: undefined };
}

export const DropIndexRequest: MessageFns<DropIndexRequest> = {
  encode(message: DropIndexRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
    if (message.graph !== "") {
      writer.uint32(10).string(message.graph);
    }
    if (message.propertyIndex !== undefined) {
      PropertyIndexDef.encode(message.propertyIndex, writer.uint32(18).fork()).join();
    }
    if (message.vectorIndex !== undefined) {
      VectorIndexDef.encode(message.vectorIndex, writer.uint32(26).fork()).join();
    }
    if (message.textIndex !== undefined) {
      TextIndexDef.encode(message.textIndex, writer.uint32(34).fork()).join();
    }
    return writer;
  },

  decode(input: BinaryReader | Uint8Array, length?: number): DropIndexRequest {
    const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
    const end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseDropIndexRequest();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1: {
          if (tag !== 10) {
            break;
          }

          message.graph = reader.string();
          continue;
        }
        case 2: {
          if (tag !== 18) {
            break;
          }

          message.propertyIndex = PropertyIndexDef.decode(reader, reader.uint32());
          continue;
        }
        case 3: {
          if (tag !== 26) {
            break;
          }

          message.vectorIndex = VectorIndexDef.decode(reader, reader.uint32());
          continue;
        }
        case 4: {
          if (tag !== 34) {
            break;
          }

          message.textIndex = TextIndexDef.decode(reader, reader.uint32());
          continue;
        }
      }
      if ((tag & 7) === 4 || tag === 0) {
        break;
      }
      reader.skip(tag & 7);
    }
    return message;
  },

  fromJSON(object: any): DropIndexRequest {
    return {
      graph: isSet(object.graph) ? globalThis.String(object.graph) : "",
      propertyIndex: isSet(object.propertyIndex)
        ? PropertyIndexDef.fromJSON(object.propertyIndex)
        : isSet(object.property_index)
        ? PropertyIndexDef.fromJSON(object.property_index)
        : undefined,
      vectorIndex: isSet(object.vectorIndex)
        ? VectorIndexDef.fromJSON(object.vectorIndex)
        : isSet(object.vector_index)
        ? VectorIndexDef.fromJSON(object.vector_index)
        : undefined,
      textIndex: isSet(object.textIndex)
        ? TextIndexDef.fromJSON(object.textIndex)
        : isSet(object.text_index)
        ? TextIndexDef.fromJSON(object.text_index)
        : undefined,
    };
  },

  toJSON(message: DropIndexRequest): unknown {
    const obj: any = {};
    if (message.graph !== "") {
      obj.graph = message.graph;
    }
    if (message.propertyIndex !== undefined) {
      obj.propertyIndex = PropertyIndexDef.toJSON(message.propertyIndex);
    }
    if (message.vectorIndex !== undefined) {
      obj.vectorIndex = VectorIndexDef.toJSON(message.vectorIndex);
    }
    if (message.textIndex !== undefined) {
      obj.textIndex = TextIndexDef.toJSON(message.textIndex);
    }
    return obj;
  },

  create<I extends Exact<DeepPartial<DropIndexRequest>, I>>(base?: I): DropIndexRequest {
    return DropIndexRequest.fromPartial(base ?? ({} as any));
  },
  fromPartial<I extends Exact<DeepPartial<DropIndexRequest>, I>>(object: I): DropIndexRequest {
    const message = createBaseDropIndexRequest();
    message.graph = object.graph ?? "";
    message.propertyIndex = (object.propertyIndex !== undefined && object.propertyIndex !== null)
      ? PropertyIndexDef.fromPartial(object.propertyIndex)
      : undefined;
    message.vectorIndex = (object.vectorIndex !== undefined && object.vectorIndex !== null)
      ? VectorIndexDef.fromPartial(object.vectorIndex)
      : undefined;
    message.textIndex = (object.textIndex !== undefined && object.textIndex !== null)
      ? TextIndexDef.fromPartial(object.textIndex)
      : undefined;
    return message;
  },
};

function createBaseDropIndexResponse(): DropIndexResponse {
  return { existed: false };
}

export const DropIndexResponse: MessageFns<DropIndexResponse> = {
  encode(message: DropIndexResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
    if (message.existed !== false) {
      writer.uint32(8).bool(message.existed);
    }
    return writer;
  },

  decode(input: BinaryReader | Uint8Array, length?: number): DropIndexResponse {
    const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
    const end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseDropIndexResponse();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1: {
          if (tag !== 8) {
            break;
          }

          message.existed = reader.bool();
          continue;
        }
      }
      if ((tag & 7) === 4 || tag === 0) {
        break;
      }
      reader.skip(tag & 7);
    }
    return message;
  },

  fromJSON(object: any): DropIndexResponse {
    return { existed: isSet(object.existed) ? globalThis.Boolean(object.existed) : false };
  },

  toJSON(message: DropIndexResponse): unknown {
    const obj: any = {};
    if (message.existed !== false) {
      obj.existed = message.existed;
    }
    return obj;
  },

  create<I extends Exact<DeepPartial<DropIndexResponse>, I>>(base?: I): DropIndexResponse {
    return DropIndexResponse.fromPartial(base ?? ({} as any));
  },
  fromPartial<I extends Exact<DeepPartial<DropIndexResponse>, I>>(object: I): DropIndexResponse {
    const message = createBaseDropIndexResponse();
    message.existed = object.existed ?? false;
    return message;
  },
};

function createBaseVectorSearchRequest(): VectorSearchRequest {
  return { graph: "", label: "", property: "", queryVector: [], k: 0, ef: undefined, filters: {} };
}

export const VectorSearchRequest: MessageFns<VectorSearchRequest> = {
  encode(message: VectorSearchRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
    if (message.graph !== "") {
      writer.uint32(10).string(message.graph);
    }
    if (message.label !== "") {
      writer.uint32(18).string(message.label);
    }
    if (message.property !== "") {
      writer.uint32(26).string(message.property);
    }
    writer.uint32(34).fork();
    for (const v of message.queryVector) {
      writer.float(v);
    }
    writer.join();
    if (message.k !== 0) {
      writer.uint32(40).uint32(message.k);
    }
    if (message.ef !== undefined) {
      writer.uint32(48).uint32(message.ef);
    }
    globalThis.Object.entries(message.filters).forEach(([key, value]: [string, Value]) => {
      VectorSearchRequest_FiltersEntry.encode({ key: key as any, value }, writer.uint32(58).fork()).join();
    });
    return writer;
  },

  decode(input: BinaryReader | Uint8Array, length?: number): VectorSearchRequest {
    const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
    const end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseVectorSearchRequest();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1: {
          if (tag !== 10) {
            break;
          }

          message.graph = reader.string();
          continue;
        }
        case 2: {
          if (tag !== 18) {
            break;
          }

          message.label = reader.string();
          continue;
        }
        case 3: {
          if (tag !== 26) {
            break;
          }

          message.property = reader.string();
          continue;
        }
        case 4: {
          if (tag === 37) {
            message.queryVector.push(reader.float());

            continue;
          }

          if (tag === 34) {
            const end2 = reader.uint32() + reader.pos;
            while (reader.pos < end2) {
              message.queryVector.push(reader.float());
            }

            continue;
          }

          break;
        }
        case 5: {
          if (tag !== 40) {
            break;
          }

          message.k = reader.uint32();
          continue;
        }
        case 6: {
          if (tag !== 48) {
            break;
          }

          message.ef = reader.uint32();
          continue;
        }
        case 7: {
          if (tag !== 58) {
            break;
          }

          const entry7 = VectorSearchRequest_FiltersEntry.decode(reader, reader.uint32());
          if (entry7.value !== undefined) {
            message.filters[entry7.key] = entry7.value;
          }
          continue;
        }
      }
      if ((tag & 7) === 4 || tag === 0) {
        break;
      }
      reader.skip(tag & 7);
    }
    return message;
  },

  fromJSON(object: any): VectorSearchRequest {
    return {
      graph: isSet(object.graph) ? globalThis.String(object.graph) : "",
      label: isSet(object.label) ? globalThis.String(object.label) : "",
      property: isSet(object.property) ? globalThis.String(object.property) : "",
      queryVector: globalThis.Array.isArray(object?.queryVector)
        ? object.queryVector.map((e: any) => globalThis.Number(e))
        : globalThis.Array.isArray(object?.query_vector)
        ? object.query_vector.map((e: any) => globalThis.Number(e))
        : [],
      k: isSet(object.k) ? globalThis.Number(object.k) : 0,
      ef: isSet(object.ef) ? globalThis.Number(object.ef) : undefined,
      filters: isObject(object.filters)
        ? (globalThis.Object.entries(object.filters) as [string, any][]).reduce(
          (acc: { [key: string]: Value }, [key, value]: [string, any]) => {
            acc[key] = Value.fromJSON(value);
            return acc;
          },
          {},
        )
        : {},
    };
  },

  toJSON(message: VectorSearchRequest): unknown {
    const obj: any = {};
    if (message.graph !== "") {
      obj.graph = message.graph;
    }
    if (message.label !== "") {
      obj.label = message.label;
    }
    if (message.property !== "") {
      obj.property = message.property;
    }
    if (message.queryVector?.length) {
      obj.queryVector = message.queryVector;
    }
    if (message.k !== 0) {
      obj.k = Math.round(message.k);
    }
    if (message.ef !== undefined) {
      obj.ef = Math.round(message.ef);
    }
    if (message.filters) {
      const entries = globalThis.Object.entries(message.filters) as [string, Value][];
      if (entries.length > 0) {
        obj.filters = {};
        entries.forEach(([k, v]) => {
          obj.filters[k] = Value.toJSON(v);
        });
      }
    }
    return obj;
  },

  create<I extends Exact<DeepPartial<VectorSearchRequest>, I>>(base?: I): VectorSearchRequest {
    return VectorSearchRequest.fromPartial(base ?? ({} as any));
  },
  fromPartial<I extends Exact<DeepPartial<VectorSearchRequest>, I>>(object: I): VectorSearchRequest {
    const message = createBaseVectorSearchRequest();
    message.graph = object.graph ?? "";
    message.label = object.label ?? "";
    message.property = object.property ?? "";
    message.queryVector = object.queryVector?.map((e) => e) || [];
    message.k = object.k ?? 0;
    message.ef = object.ef ?? undefined;
    message.filters = (globalThis.Object.entries(object.filters ?? {}) as [string, Value][]).reduce(
      (acc: { [key: string]: Value }, [key, value]: [string, Value]) => {
        if (value !== undefined) {
          acc[key] = Value.fromPartial(value);
        }
        return acc;
      },
      {},
    );
    return message;
  },
};

function createBaseVectorSearchRequest_FiltersEntry(): VectorSearchRequest_FiltersEntry {
  return { key: "", value: undefined };
}

export const VectorSearchRequest_FiltersEntry: MessageFns<VectorSearchRequest_FiltersEntry> = {
  encode(message: VectorSearchRequest_FiltersEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
    if (message.key !== "") {
      writer.uint32(10).string(message.key);
    }
    if (message.value !== undefined) {
      Value.encode(message.value, writer.uint32(18).fork()).join();
    }
    return writer;
  },

  decode(input: BinaryReader | Uint8Array, length?: number): VectorSearchRequest_FiltersEntry {
    const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
    const end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseVectorSearchRequest_FiltersEntry();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1: {
          if (tag !== 10) {
            break;
          }

          message.key = reader.string();
          continue;
        }
        case 2: {
          if (tag !== 18) {
            break;
          }

          message.value = Value.decode(reader, reader.uint32());
          continue;
        }
      }
      if ((tag & 7) === 4 || tag === 0) {
        break;
      }
      reader.skip(tag & 7);
    }
    return message;
  },

  fromJSON(object: any): VectorSearchRequest_FiltersEntry {
    return {
      key: isSet(object.key) ? globalThis.String(object.key) : "",
      value: isSet(object.value) ? Value.fromJSON(object.value) : undefined,
    };
  },

  toJSON(message: VectorSearchRequest_FiltersEntry): unknown {
    const obj: any = {};
    if (message.key !== "") {
      obj.key = message.key;
    }
    if (message.value !== undefined) {
      obj.value = Value.toJSON(message.value);
    }
    return obj;
  },

  create<I extends Exact<DeepPartial<VectorSearchRequest_FiltersEntry>, I>>(
    base?: I,
  ): VectorSearchRequest_FiltersEntry {
    return VectorSearchRequest_FiltersEntry.fromPartial(base ?? ({} as any));
  },
  fromPartial<I extends Exact<DeepPartial<VectorSearchRequest_FiltersEntry>, I>>(
    object: I,
  ): VectorSearchRequest_FiltersEntry {
    const message = createBaseVectorSearchRequest_FiltersEntry();
    message.key = object.key ?? "";
    message.value = (object.value !== undefined && object.value !== null) ? Value.fromPartial(object.value) : undefined;
    return message;
  },
};

function createBaseTextSearchRequest(): TextSearchRequest {
  return { graph: "", label: "", property: "", query: "", k: 0 };
}

export const TextSearchRequest: MessageFns<TextSearchRequest> = {
  encode(message: TextSearchRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
    if (message.graph !== "") {
      writer.uint32(10).string(message.graph);
    }
    if (message.label !== "") {
      writer.uint32(18).string(message.label);
    }
    if (message.property !== "") {
      writer.uint32(26).string(message.property);
    }
    if (message.query !== "") {
      writer.uint32(34).string(message.query);
    }
    if (message.k !== 0) {
      writer.uint32(40).uint32(message.k);
    }
    return writer;
  },

  decode(input: BinaryReader | Uint8Array, length?: number): TextSearchRequest {
    const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
    const end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseTextSearchRequest();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1: {
          if (tag !== 10) {
            break;
          }

          message.graph = reader.string();
          continue;
        }
        case 2: {
          if (tag !== 18) {
            break;
          }

          message.label = reader.string();
          continue;
        }
        case 3: {
          if (tag !== 26) {
            break;
          }

          message.property = reader.string();
          continue;
        }
        case 4: {
          if (tag !== 34) {
            break;
          }

          message.query = reader.string();
          continue;
        }
        case 5: {
          if (tag !== 40) {
            break;
          }

          message.k = reader.uint32();
          continue;
        }
      }
      if ((tag & 7) === 4 || tag === 0) {
        break;
      }
      reader.skip(tag & 7);
    }
    return message;
  },

  fromJSON(object: any): TextSearchRequest {
    return {
      graph: isSet(object.graph) ? globalThis.String(object.graph) : "",
      label: isSet(object.label) ? globalThis.String(object.label) : "",
      property: isSet(object.property) ? globalThis.String(object.property) : "",
      query: isSet(object.query) ? globalThis.String(object.query) : "",
      k: isSet(object.k) ? globalThis.Number(object.k) : 0,
    };
  },

  toJSON(message: TextSearchRequest): unknown {
    const obj: any = {};
    if (message.graph !== "") {
      obj.graph = message.graph;
    }
    if (message.label !== "") {
      obj.label = message.label;
    }
    if (message.property !== "") {
      obj.property = message.property;
    }
    if (message.query !== "") {
      obj.query = message.query;
    }
    if (message.k !== 0) {
      obj.k = Math.round(message.k);
    }
    return obj;
  },

  create<I extends Exact<DeepPartial<TextSearchRequest>, I>>(base?: I): TextSearchRequest {
    return TextSearchRequest.fromPartial(base ?? ({} as any));
  },
  fromPartial<I extends Exact<DeepPartial<TextSearchRequest>, I>>(object: I): TextSearchRequest {
    const message = createBaseTextSearchRequest();
    message.graph = object.graph ?? "";
    message.label = object.label ?? "";
    message.property = object.property ?? "";
    message.query = object.query ?? "";
    message.k = object.k ?? 0;
    return message;
  },
};

function createBaseHybridSearchRequest(): HybridSearchRequest {
  return { graph: "", label: "", textProperty: "", vectorProperty: "", queryText: "", queryVector: [], k: 0 };
}

export const HybridSearchRequest: MessageFns<HybridSearchRequest> = {
  encode(message: HybridSearchRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
    if (message.graph !== "") {
      writer.uint32(10).string(message.graph);
    }
    if (message.label !== "") {
      writer.uint32(18).string(message.label);
    }
    if (message.textProperty !== "") {
      writer.uint32(26).string(message.textProperty);
    }
    if (message.vectorProperty !== "") {
      writer.uint32(34).string(message.vectorProperty);
    }
    if (message.queryText !== "") {
      writer.uint32(42).string(message.queryText);
    }
    writer.uint32(50).fork();
    for (const v of message.queryVector) {
      writer.float(v);
    }
    writer.join();
    if (message.k !== 0) {
      writer.uint32(56).uint32(message.k);
    }
    return writer;
  },

  decode(input: BinaryReader | Uint8Array, length?: number): HybridSearchRequest {
    const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
    const end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseHybridSearchRequest();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1: {
          if (tag !== 10) {
            break;
          }

          message.graph = reader.string();
          continue;
        }
        case 2: {
          if (tag !== 18) {
            break;
          }

          message.label = reader.string();
          continue;
        }
        case 3: {
          if (tag !== 26) {
            break;
          }

          message.textProperty = reader.string();
          continue;
        }
        case 4: {
          if (tag !== 34) {
            break;
          }

          message.vectorProperty = reader.string();
          continue;
        }
        case 5: {
          if (tag !== 42) {
            break;
          }

          message.queryText = reader.string();
          continue;
        }
        case 6: {
          if (tag === 53) {
            message.queryVector.push(reader.float());

            continue;
          }

          if (tag === 50) {
            const end2 = reader.uint32() + reader.pos;
            while (reader.pos < end2) {
              message.queryVector.push(reader.float());
            }

            continue;
          }

          break;
        }
        case 7: {
          if (tag !== 56) {
            break;
          }

          message.k = reader.uint32();
          continue;
        }
      }
      if ((tag & 7) === 4 || tag === 0) {
        break;
      }
      reader.skip(tag & 7);
    }
    return message;
  },

  fromJSON(object: any): HybridSearchRequest {
    return {
      graph: isSet(object.graph) ? globalThis.String(object.graph) : "",
      label: isSet(object.label) ? globalThis.String(object.label) : "",
      textProperty: isSet(object.textProperty)
        ? globalThis.String(object.textProperty)
        : isSet(object.text_property)
        ? globalThis.String(object.text_property)
        : "",
      vectorProperty: isSet(object.vectorProperty)
        ? globalThis.String(object.vectorProperty)
        : isSet(object.vector_property)
        ? globalThis.String(object.vector_property)
        : "",
      queryText: isSet(object.queryText)
        ? globalThis.String(object.queryText)
        : isSet(object.query_text)
        ? globalThis.String(object.query_text)
        : "",
      queryVector: globalThis.Array.isArray(object?.queryVector)
        ? object.queryVector.map((e: any) => globalThis.Number(e))
        : globalThis.Array.isArray(object?.query_vector)
        ? object.query_vector.map((e: any) => globalThis.Number(e))
        : [],
      k: isSet(object.k) ? globalThis.Number(object.k) : 0,
    };
  },

  toJSON(message: HybridSearchRequest): unknown {
    const obj: any = {};
    if (message.graph !== "") {
      obj.graph = message.graph;
    }
    if (message.label !== "") {
      obj.label = message.label;
    }
    if (message.textProperty !== "") {
      obj.textProperty = message.textProperty;
    }
    if (message.vectorProperty !== "") {
      obj.vectorProperty = message.vectorProperty;
    }
    if (message.queryText !== "") {
      obj.queryText = message.queryText;
    }
    if (message.queryVector?.length) {
      obj.queryVector = message.queryVector;
    }
    if (message.k !== 0) {
      obj.k = Math.round(message.k);
    }
    return obj;
  },

  create<I extends Exact<DeepPartial<HybridSearchRequest>, I>>(base?: I): HybridSearchRequest {
    return HybridSearchRequest.fromPartial(base ?? ({} as any));
  },
  fromPartial<I extends Exact<DeepPartial<HybridSearchRequest>, I>>(object: I): HybridSearchRequest {
    const message = createBaseHybridSearchRequest();
    message.graph = object.graph ?? "";
    message.label = object.label ?? "";
    message.textProperty = object.textProperty ?? "";
    message.vectorProperty = object.vectorProperty ?? "";
    message.queryText = object.queryText ?? "";
    message.queryVector = object.queryVector?.map((e) => e) || [];
    message.k = object.k ?? 0;
    return message;
  },
};

function createBaseSearchHit(): SearchHit {
  return { nodeId: 0n, score: 0, properties: {} };
}

export const SearchHit: MessageFns<SearchHit> = {
  encode(message: SearchHit, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
    if (message.nodeId !== 0n) {
      if (BigInt.asUintN(64, message.nodeId) !== message.nodeId) {
        throw new globalThis.Error("value provided for field message.nodeId of type uint64 too large");
      }
      writer.uint32(8).uint64(message.nodeId);
    }
    if (message.score !== 0) {
      writer.uint32(17).double(message.score);
    }
    globalThis.Object.entries(message.properties).forEach(([key, value]: [string, Value]) => {
      SearchHit_PropertiesEntry.encode({ key: key as any, value }, writer.uint32(26).fork()).join();
    });
    return writer;
  },

  decode(input: BinaryReader | Uint8Array, length?: number): SearchHit {
    const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
    const end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseSearchHit();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1: {
          if (tag !== 8) {
            break;
          }

          message.nodeId = reader.uint64() as bigint;
          continue;
        }
        case 2: {
          if (tag !== 17) {
            break;
          }

          message.score = reader.double();
          continue;
        }
        case 3: {
          if (tag !== 26) {
            break;
          }

          const entry3 = SearchHit_PropertiesEntry.decode(reader, reader.uint32());
          if (entry3.value !== undefined) {
            message.properties[entry3.key] = entry3.value;
          }
          continue;
        }
      }
      if ((tag & 7) === 4 || tag === 0) {
        break;
      }
      reader.skip(tag & 7);
    }
    return message;
  },

  fromJSON(object: any): SearchHit {
    return {
      nodeId: isSet(object.nodeId) ? BigInt(object.nodeId) : isSet(object.node_id) ? BigInt(object.node_id) : 0n,
      score: isSet(object.score) ? globalThis.Number(object.score) : 0,
      properties: isObject(object.properties)
        ? (globalThis.Object.entries(object.properties) as [string, any][]).reduce(
          (acc: { [key: string]: Value }, [key, value]: [string, any]) => {
            acc[key] = Value.fromJSON(value);
            return acc;
          },
          {},
        )
        : {},
    };
  },

  toJSON(message: SearchHit): unknown {
    const obj: any = {};
    if (message.nodeId !== 0n) {
      obj.nodeId = message.nodeId.toString();
    }
    if (message.score !== 0) {
      obj.score = message.score;
    }
    if (message.properties) {
      const entries = globalThis.Object.entries(message.properties) as [string, Value][];
      if (entries.length > 0) {
        obj.properties = {};
        entries.forEach(([k, v]) => {
          obj.properties[k] = Value.toJSON(v);
        });
      }
    }
    return obj;
  },

  create<I extends Exact<DeepPartial<SearchHit>, I>>(base?: I): SearchHit {
    return SearchHit.fromPartial(base ?? ({} as any));
  },
  fromPartial<I extends Exact<DeepPartial<SearchHit>, I>>(object: I): SearchHit {
    const message = createBaseSearchHit();
    message.nodeId = object.nodeId ?? 0n;
    message.score = object.score ?? 0;
    message.properties = (globalThis.Object.entries(object.properties ?? {}) as [string, Value][]).reduce(
      (acc: { [key: string]: Value }, [key, value]: [string, Value]) => {
        if (value !== undefined) {
          acc[key] = Value.fromPartial(value);
        }
        return acc;
      },
      {},
    );
    return message;
  },
};

function createBaseSearchHit_PropertiesEntry(): SearchHit_PropertiesEntry {
  return { key: "", value: undefined };
}

export const SearchHit_PropertiesEntry: MessageFns<SearchHit_PropertiesEntry> = {
  encode(message: SearchHit_PropertiesEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
    if (message.key !== "") {
      writer.uint32(10).string(message.key);
    }
    if (message.value !== undefined) {
      Value.encode(message.value, writer.uint32(18).fork()).join();
    }
    return writer;
  },

  decode(input: BinaryReader | Uint8Array, length?: number): SearchHit_PropertiesEntry {
    const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
    const end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseSearchHit_PropertiesEntry();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1: {
          if (tag !== 10) {
            break;
          }

          message.key = reader.string();
          continue;
        }
        case 2: {
          if (tag !== 18) {
            break;
          }

          message.value = Value.decode(reader, reader.uint32());
          continue;
        }
      }
      if ((tag & 7) === 4 || tag === 0) {
        break;
      }
      reader.skip(tag & 7);
    }
    return message;
  },

  fromJSON(object: any): SearchHit_PropertiesEntry {
    return {
      key: isSet(object.key) ? globalThis.String(object.key) : "",
      value: isSet(object.value) ? Value.fromJSON(object.value) : undefined,
    };
  },

  toJSON(message: SearchHit_PropertiesEntry): unknown {
    const obj: any = {};
    if (message.key !== "") {
      obj.key = message.key;
    }
    if (message.value !== undefined) {
      obj.value = Value.toJSON(message.value);
    }
    return obj;
  },

  create<I extends Exact<DeepPartial<SearchHit_PropertiesEntry>, I>>(base?: I): SearchHit_PropertiesEntry {
    return SearchHit_PropertiesEntry.fromPartial(base ?? ({} as any));
  },
  fromPartial<I extends Exact<DeepPartial<SearchHit_PropertiesEntry>, I>>(object: I): SearchHit_PropertiesEntry {
    const message = createBaseSearchHit_PropertiesEntry();
    message.key = object.key ?? "";
    message.value = (object.value !== undefined && object.value !== null) ? Value.fromPartial(object.value) : undefined;
    return message;
  },
};

function createBaseVectorSearchResponse(): VectorSearchResponse {
  return { hits: [] };
}

export const VectorSearchResponse: MessageFns<VectorSearchResponse> = {
  encode(message: VectorSearchResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
    for (const v of message.hits) {
      SearchHit.encode(v!, writer.uint32(10).fork()).join();
    }
    return writer;
  },

  decode(input: BinaryReader | Uint8Array, length?: number): VectorSearchResponse {
    const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
    const end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseVectorSearchResponse();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1: {
          if (tag !== 10) {
            break;
          }

          message.hits.push(SearchHit.decode(reader, reader.uint32()));
          continue;
        }
      }
      if ((tag & 7) === 4 || tag === 0) {
        break;
      }
      reader.skip(tag & 7);
    }
    return message;
  },

  fromJSON(object: any): VectorSearchResponse {
    return { hits: globalThis.Array.isArray(object?.hits) ? object.hits.map((e: any) => SearchHit.fromJSON(e)) : [] };
  },

  toJSON(message: VectorSearchResponse): unknown {
    const obj: any = {};
    if (message.hits?.length) {
      obj.hits = message.hits.map((e) => SearchHit.toJSON(e));
    }
    return obj;
  },

  create<I extends Exact<DeepPartial<VectorSearchResponse>, I>>(base?: I): VectorSearchResponse {
    return VectorSearchResponse.fromPartial(base ?? ({} as any));
  },
  fromPartial<I extends Exact<DeepPartial<VectorSearchResponse>, I>>(object: I): VectorSearchResponse {
    const message = createBaseVectorSearchResponse();
    message.hits = object.hits?.map((e) => SearchHit.fromPartial(e)) || [];
    return message;
  },
};

function createBaseTextSearchResponse(): TextSearchResponse {
  return { hits: [] };
}

export const TextSearchResponse: MessageFns<TextSearchResponse> = {
  encode(message: TextSearchResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
    for (const v of message.hits) {
      SearchHit.encode(v!, writer.uint32(10).fork()).join();
    }
    return writer;
  },

  decode(input: BinaryReader | Uint8Array, length?: number): TextSearchResponse {
    const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
    const end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseTextSearchResponse();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1: {
          if (tag !== 10) {
            break;
          }

          message.hits.push(SearchHit.decode(reader, reader.uint32()));
          continue;
        }
      }
      if ((tag & 7) === 4 || tag === 0) {
        break;
      }
      reader.skip(tag & 7);
    }
    return message;
  },

  fromJSON(object: any): TextSearchResponse {
    return { hits: globalThis.Array.isArray(object?.hits) ? object.hits.map((e: any) => SearchHit.fromJSON(e)) : [] };
  },

  toJSON(message: TextSearchResponse): unknown {
    const obj: any = {};
    if (message.hits?.length) {
      obj.hits = message.hits.map((e) => SearchHit.toJSON(e));
    }
    return obj;
  },

  create<I extends Exact<DeepPartial<TextSearchResponse>, I>>(base?: I): TextSearchResponse {
    return TextSearchResponse.fromPartial(base ?? ({} as any));
  },
  fromPartial<I extends Exact<DeepPartial<TextSearchResponse>, I>>(object: I): TextSearchResponse {
    const message = createBaseTextSearchResponse();
    message.hits = object.hits?.map((e) => SearchHit.fromPartial(e)) || [];
    return message;
  },
};

function createBaseHybridSearchResponse(): HybridSearchResponse {
  return { hits: [] };
}

export const HybridSearchResponse: MessageFns<HybridSearchResponse> = {
  encode(message: HybridSearchResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
    for (const v of message.hits) {
      SearchHit.encode(v!, writer.uint32(10).fork()).join();
    }
    return writer;
  },

  decode(input: BinaryReader | Uint8Array, length?: number): HybridSearchResponse {
    const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
    const end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseHybridSearchResponse();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1: {
          if (tag !== 10) {
            break;
          }

          message.hits.push(SearchHit.decode(reader, reader.uint32()));
          continue;
        }
      }
      if ((tag & 7) === 4 || tag === 0) {
        break;
      }
      reader.skip(tag & 7);
    }
    return message;
  },

  fromJSON(object: any): HybridSearchResponse {
    return { hits: globalThis.Array.isArray(object?.hits) ? object.hits.map((e: any) => SearchHit.fromJSON(e)) : [] };
  },

  toJSON(message: HybridSearchResponse): unknown {
    const obj: any = {};
    if (message.hits?.length) {
      obj.hits = message.hits.map((e) => SearchHit.toJSON(e));
    }
    return obj;
  },

  create<I extends Exact<DeepPartial<HybridSearchResponse>, I>>(base?: I): HybridSearchResponse {
    return HybridSearchResponse.fromPartial(base ?? ({} as any));
  },
  fromPartial<I extends Exact<DeepPartial<HybridSearchResponse>, I>>(object: I): HybridSearchResponse {
    const message = createBaseHybridSearchResponse();
    message.hits = object.hits?.map((e) => SearchHit.fromPartial(e)) || [];
    return message;
  },
};

export type SessionServiceService = typeof SessionServiceService;
export const SessionServiceService = {
  /** Establish a session. Negotiates protocol version and authenticates. */
  handshake: {
    path: "/gql.SessionService/Handshake",
    requestStream: false,
    responseStream: false,
    requestSerialize: (value: HandshakeRequest): Buffer => Buffer.from(HandshakeRequest.encode(value).finish()),
    requestDeserialize: (value: Buffer): HandshakeRequest => HandshakeRequest.decode(value),
    responseSerialize: (value: HandshakeResponse): Buffer => Buffer.from(HandshakeResponse.encode(value).finish()),
    responseDeserialize: (value: Buffer): HandshakeResponse => HandshakeResponse.decode(value),
  },
  /** Configure session state (schema, graph, timezone, parameters). */
  configure: {
    path: "/gql.SessionService/Configure",
    requestStream: false,
    responseStream: false,
    requestSerialize: (value: ConfigureRequest): Buffer => Buffer.from(ConfigureRequest.encode(value).finish()),
    requestDeserialize: (value: Buffer): ConfigureRequest => ConfigureRequest.decode(value),
    responseSerialize: (value: ConfigureResponse): Buffer => Buffer.from(ConfigureResponse.encode(value).finish()),
    responseDeserialize: (value: Buffer): ConfigureResponse => ConfigureResponse.decode(value),
  },
  /** Reset session state to defaults. */
  reset: {
    path: "/gql.SessionService/Reset",
    requestStream: false,
    responseStream: false,
    requestSerialize: (value: ResetRequest): Buffer => Buffer.from(ResetRequest.encode(value).finish()),
    requestDeserialize: (value: Buffer): ResetRequest => ResetRequest.decode(value),
    responseSerialize: (value: ResetResponse): Buffer => Buffer.from(ResetResponse.encode(value).finish()),
    responseDeserialize: (value: Buffer): ResetResponse => ResetResponse.decode(value),
  },
  /** Terminate the session. Rolls back any active transaction. */
  close: {
    path: "/gql.SessionService/Close",
    requestStream: false,
    responseStream: false,
    requestSerialize: (value: CloseRequest): Buffer => Buffer.from(CloseRequest.encode(value).finish()),
    requestDeserialize: (value: Buffer): CloseRequest => CloseRequest.decode(value),
    responseSerialize: (value: CloseResponse): Buffer => Buffer.from(CloseResponse.encode(value).finish()),
    responseDeserialize: (value: Buffer): CloseResponse => CloseResponse.decode(value),
  },
  /** Health check and keepalive. */
  ping: {
    path: "/gql.SessionService/Ping",
    requestStream: false,
    responseStream: false,
    requestSerialize: (value: PingRequest): Buffer => Buffer.from(PingRequest.encode(value).finish()),
    requestDeserialize: (value: Buffer): PingRequest => PingRequest.decode(value),
    responseSerialize: (value: PongResponse): Buffer => Buffer.from(PongResponse.encode(value).finish()),
    responseDeserialize: (value: Buffer): PongResponse => PongResponse.decode(value),
  },
} as const;

export interface SessionServiceServer extends UntypedServiceImplementation {
  /** Establish a session. Negotiates protocol version and authenticates. */
  handshake: handleUnaryCall<HandshakeRequest, HandshakeResponse>;
  /** Configure session state (schema, graph, timezone, parameters). */
  configure: handleUnaryCall<ConfigureRequest, ConfigureResponse>;
  /** Reset session state to defaults. */
  reset: handleUnaryCall<ResetRequest, ResetResponse>;
  /** Terminate the session. Rolls back any active transaction. */
  close: handleUnaryCall<CloseRequest, CloseResponse>;
  /** Health check and keepalive. */
  ping: handleUnaryCall<PingRequest, PongResponse>;
}

export interface SessionServiceClient extends Client {
  /** Establish a session. Negotiates protocol version and authenticates. */
  handshake(
    request: HandshakeRequest,
    callback: (error: ServiceError | null, response: HandshakeResponse) => void,
  ): ClientUnaryCall;
  handshake(
    request: HandshakeRequest,
    metadata: Metadata,
    callback: (error: ServiceError | null, response: HandshakeResponse) => void,
  ): ClientUnaryCall;
  handshake(
    request: HandshakeRequest,
    metadata: Metadata,
    options: Partial<CallOptions>,
    callback: (error: ServiceError | null, response: HandshakeResponse) => void,
  ): ClientUnaryCall;
  /** Configure session state (schema, graph, timezone, parameters). */
  configure(
    request: ConfigureRequest,
    callback: (error: ServiceError | null, response: ConfigureResponse) => void,
  ): ClientUnaryCall;
  configure(
    request: ConfigureRequest,
    metadata: Metadata,
    callback: (error: ServiceError | null, response: ConfigureResponse) => void,
  ): ClientUnaryCall;
  configure(
    request: ConfigureRequest,
    metadata: Metadata,
    options: Partial<CallOptions>,
    callback: (error: ServiceError | null, response: ConfigureResponse) => void,
  ): ClientUnaryCall;
  /** Reset session state to defaults. */
  reset(
    request: ResetRequest,
    callback: (error: ServiceError | null, response: ResetResponse) => void,
  ): ClientUnaryCall;
  reset(
    request: ResetRequest,
    metadata: Metadata,
    callback: (error: ServiceError | null, response: ResetResponse) => void,
  ): ClientUnaryCall;
  reset(
    request: ResetRequest,
    metadata: Metadata,
    options: Partial<CallOptions>,
    callback: (error: ServiceError | null, response: ResetResponse) => void,
  ): ClientUnaryCall;
  /** Terminate the session. Rolls back any active transaction. */
  close(
    request: CloseRequest,
    callback: (error: ServiceError | null, response: CloseResponse) => void,
  ): ClientUnaryCall;
  close(
    request: CloseRequest,
    metadata: Metadata,
    callback: (error: ServiceError | null, response: CloseResponse) => void,
  ): ClientUnaryCall;
  close(
    request: CloseRequest,
    metadata: Metadata,
    options: Partial<CallOptions>,
    callback: (error: ServiceError | null, response: CloseResponse) => void,
  ): ClientUnaryCall;
  /** Health check and keepalive. */
  ping(request: PingRequest, callback: (error: ServiceError | null, response: PongResponse) => void): ClientUnaryCall;
  ping(
    request: PingRequest,
    metadata: Metadata,
    callback: (error: ServiceError | null, response: PongResponse) => void,
  ): ClientUnaryCall;
  ping(
    request: PingRequest,
    metadata: Metadata,
    options: Partial<CallOptions>,
    callback: (error: ServiceError | null, response: PongResponse) => void,
  ): ClientUnaryCall;
}

export const SessionServiceClient = makeGenericClientConstructor(
  SessionServiceService,
  "gql.SessionService",
) as unknown as {
  new (address: string, credentials: ChannelCredentials, options?: Partial<ClientOptions>): SessionServiceClient;
  service: typeof SessionServiceService;
  serviceName: string;
};

export type GqlServiceService = typeof GqlServiceService;
export const GqlServiceService = {
  /**
   * Execute any GQL statement. Returns a stream of response frames:
   *   1. ResultHeader  (column metadata or result type indicator)
   *   2. RowBatch*     (zero or more batches of rows)
   *   3. ResultSummary (completion status, row count, diagnostics)
   */
  execute: {
    path: "/gql.GqlService/Execute",
    requestStream: false,
    responseStream: true,
    requestSerialize: (value: ExecuteRequest): Buffer => Buffer.from(ExecuteRequest.encode(value).finish()),
    requestDeserialize: (value: Buffer): ExecuteRequest => ExecuteRequest.decode(value),
    responseSerialize: (value: ExecuteResponse): Buffer => Buffer.from(ExecuteResponse.encode(value).finish()),
    responseDeserialize: (value: Buffer): ExecuteResponse => ExecuteResponse.decode(value),
  },
  /** Begin an explicit transaction. */
  beginTransaction: {
    path: "/gql.GqlService/BeginTransaction",
    requestStream: false,
    responseStream: false,
    requestSerialize: (value: BeginRequest): Buffer => Buffer.from(BeginRequest.encode(value).finish()),
    requestDeserialize: (value: Buffer): BeginRequest => BeginRequest.decode(value),
    responseSerialize: (value: BeginResponse): Buffer => Buffer.from(BeginResponse.encode(value).finish()),
    responseDeserialize: (value: Buffer): BeginResponse => BeginResponse.decode(value),
  },
  /** Commit the active transaction. */
  commit: {
    path: "/gql.GqlService/Commit",
    requestStream: false,
    responseStream: false,
    requestSerialize: (value: CommitRequest): Buffer => Buffer.from(CommitRequest.encode(value).finish()),
    requestDeserialize: (value: Buffer): CommitRequest => CommitRequest.decode(value),
    responseSerialize: (value: CommitResponse): Buffer => Buffer.from(CommitResponse.encode(value).finish()),
    responseDeserialize: (value: Buffer): CommitResponse => CommitResponse.decode(value),
  },
  /** Roll back the active transaction. */
  rollback: {
    path: "/gql.GqlService/Rollback",
    requestStream: false,
    responseStream: false,
    requestSerialize: (value: RollbackRequest): Buffer => Buffer.from(RollbackRequest.encode(value).finish()),
    requestDeserialize: (value: Buffer): RollbackRequest => RollbackRequest.decode(value),
    responseSerialize: (value: RollbackResponse): Buffer => Buffer.from(RollbackResponse.encode(value).finish()),
    responseDeserialize: (value: Buffer): RollbackResponse => RollbackResponse.decode(value),
  },
} as const;

export interface GqlServiceServer extends UntypedServiceImplementation {
  /**
   * Execute any GQL statement. Returns a stream of response frames:
   *   1. ResultHeader  (column metadata or result type indicator)
   *   2. RowBatch*     (zero or more batches of rows)
   *   3. ResultSummary (completion status, row count, diagnostics)
   */
  execute: handleServerStreamingCall<ExecuteRequest, ExecuteResponse>;
  /** Begin an explicit transaction. */
  beginTransaction: handleUnaryCall<BeginRequest, BeginResponse>;
  /** Commit the active transaction. */
  commit: handleUnaryCall<CommitRequest, CommitResponse>;
  /** Roll back the active transaction. */
  rollback: handleUnaryCall<RollbackRequest, RollbackResponse>;
}

export interface GqlServiceClient extends Client {
  /**
   * Execute any GQL statement. Returns a stream of response frames:
   *   1. ResultHeader  (column metadata or result type indicator)
   *   2. RowBatch*     (zero or more batches of rows)
   *   3. ResultSummary (completion status, row count, diagnostics)
   */
  execute(request: ExecuteRequest, options?: Partial<CallOptions>): ClientReadableStream<ExecuteResponse>;
  execute(
    request: ExecuteRequest,
    metadata?: Metadata,
    options?: Partial<CallOptions>,
  ): ClientReadableStream<ExecuteResponse>;
  /** Begin an explicit transaction. */
  beginTransaction(
    request: BeginRequest,
    callback: (error: ServiceError | null, response: BeginResponse) => void,
  ): ClientUnaryCall;
  beginTransaction(
    request: BeginRequest,
    metadata: Metadata,
    callback: (error: ServiceError | null, response: BeginResponse) => void,
  ): ClientUnaryCall;
  beginTransaction(
    request: BeginRequest,
    metadata: Metadata,
    options: Partial<CallOptions>,
    callback: (error: ServiceError | null, response: BeginResponse) => void,
  ): ClientUnaryCall;
  /** Commit the active transaction. */
  commit(
    request: CommitRequest,
    callback: (error: ServiceError | null, response: CommitResponse) => void,
  ): ClientUnaryCall;
  commit(
    request: CommitRequest,
    metadata: Metadata,
    callback: (error: ServiceError | null, response: CommitResponse) => void,
  ): ClientUnaryCall;
  commit(
    request: CommitRequest,
    metadata: Metadata,
    options: Partial<CallOptions>,
    callback: (error: ServiceError | null, response: CommitResponse) => void,
  ): ClientUnaryCall;
  /** Roll back the active transaction. */
  rollback(
    request: RollbackRequest,
    callback: (error: ServiceError | null, response: RollbackResponse) => void,
  ): ClientUnaryCall;
  rollback(
    request: RollbackRequest,
    metadata: Metadata,
    callback: (error: ServiceError | null, response: RollbackResponse) => void,
  ): ClientUnaryCall;
  rollback(
    request: RollbackRequest,
    metadata: Metadata,
    options: Partial<CallOptions>,
    callback: (error: ServiceError | null, response: RollbackResponse) => void,
  ): ClientUnaryCall;
}

export const GqlServiceClient = makeGenericClientConstructor(GqlServiceService, "gql.GqlService") as unknown as {
  new (address: string, credentials: ChannelCredentials, options?: Partial<ClientOptions>): GqlServiceClient;
  service: typeof GqlServiceService;
  serviceName: string;
};

export type CatalogServiceService = typeof CatalogServiceService;
export const CatalogServiceService = {
  /** Schema management (sec 12.2, 12.3 - Feature GC01) */
  listSchemas: {
    path: "/gql.CatalogService/ListSchemas",
    requestStream: false,
    responseStream: false,
    requestSerialize: (value: ListSchemasRequest): Buffer => Buffer.from(ListSchemasRequest.encode(value).finish()),
    requestDeserialize: (value: Buffer): ListSchemasRequest => ListSchemasRequest.decode(value),
    responseSerialize: (value: ListSchemasResponse): Buffer => Buffer.from(ListSchemasResponse.encode(value).finish()),
    responseDeserialize: (value: Buffer): ListSchemasResponse => ListSchemasResponse.decode(value),
  },
  createSchema: {
    path: "/gql.CatalogService/CreateSchema",
    requestStream: false,
    responseStream: false,
    requestSerialize: (value: CreateSchemaRequest): Buffer => Buffer.from(CreateSchemaRequest.encode(value).finish()),
    requestDeserialize: (value: Buffer): CreateSchemaRequest => CreateSchemaRequest.decode(value),
    responseSerialize: (value: CreateSchemaResponse): Buffer =>
      Buffer.from(CreateSchemaResponse.encode(value).finish()),
    responseDeserialize: (value: Buffer): CreateSchemaResponse => CreateSchemaResponse.decode(value),
  },
  dropSchema: {
    path: "/gql.CatalogService/DropSchema",
    requestStream: false,
    responseStream: false,
    requestSerialize: (value: DropSchemaRequest): Buffer => Buffer.from(DropSchemaRequest.encode(value).finish()),
    requestDeserialize: (value: Buffer): DropSchemaRequest => DropSchemaRequest.decode(value),
    responseSerialize: (value: DropSchemaResponse): Buffer => Buffer.from(DropSchemaResponse.encode(value).finish()),
    responseDeserialize: (value: Buffer): DropSchemaResponse => DropSchemaResponse.decode(value),
  },
  /** Graph management (sec 12.4, 12.5 - Feature GC04) */
  listGraphs: {
    path: "/gql.CatalogService/ListGraphs",
    requestStream: false,
    responseStream: false,
    requestSerialize: (value: ListGraphsRequest): Buffer => Buffer.from(ListGraphsRequest.encode(value).finish()),
    requestDeserialize: (value: Buffer): ListGraphsRequest => ListGraphsRequest.decode(value),
    responseSerialize: (value: ListGraphsResponse): Buffer => Buffer.from(ListGraphsResponse.encode(value).finish()),
    responseDeserialize: (value: Buffer): ListGraphsResponse => ListGraphsResponse.decode(value),
  },
  createGraph: {
    path: "/gql.CatalogService/CreateGraph",
    requestStream: false,
    responseStream: false,
    requestSerialize: (value: CreateGraphRequest): Buffer => Buffer.from(CreateGraphRequest.encode(value).finish()),
    requestDeserialize: (value: Buffer): CreateGraphRequest => CreateGraphRequest.decode(value),
    responseSerialize: (value: CreateGraphResponse): Buffer => Buffer.from(CreateGraphResponse.encode(value).finish()),
    responseDeserialize: (value: Buffer): CreateGraphResponse => CreateGraphResponse.decode(value),
  },
  dropGraph: {
    path: "/gql.CatalogService/DropGraph",
    requestStream: false,
    responseStream: false,
    requestSerialize: (value: DropGraphRequest): Buffer => Buffer.from(DropGraphRequest.encode(value).finish()),
    requestDeserialize: (value: Buffer): DropGraphRequest => DropGraphRequest.decode(value),
    responseSerialize: (value: DropGraphResponse): Buffer => Buffer.from(DropGraphResponse.encode(value).finish()),
    responseDeserialize: (value: Buffer): DropGraphResponse => DropGraphResponse.decode(value),
  },
  getGraphInfo: {
    path: "/gql.CatalogService/GetGraphInfo",
    requestStream: false,
    responseStream: false,
    requestSerialize: (value: GetGraphInfoRequest): Buffer => Buffer.from(GetGraphInfoRequest.encode(value).finish()),
    requestDeserialize: (value: Buffer): GetGraphInfoRequest => GetGraphInfoRequest.decode(value),
    responseSerialize: (value: GetGraphInfoResponse): Buffer =>
      Buffer.from(GetGraphInfoResponse.encode(value).finish()),
    responseDeserialize: (value: Buffer): GetGraphInfoResponse => GetGraphInfoResponse.decode(value),
  },
  /** Graph type management (sec 12.6, 12.7 - Feature GG02) */
  listGraphTypes: {
    path: "/gql.CatalogService/ListGraphTypes",
    requestStream: false,
    responseStream: false,
    requestSerialize: (value: ListGraphTypesRequest): Buffer =>
      Buffer.from(ListGraphTypesRequest.encode(value).finish()),
    requestDeserialize: (value: Buffer): ListGraphTypesRequest => ListGraphTypesRequest.decode(value),
    responseSerialize: (value: ListGraphTypesResponse): Buffer =>
      Buffer.from(ListGraphTypesResponse.encode(value).finish()),
    responseDeserialize: (value: Buffer): ListGraphTypesResponse => ListGraphTypesResponse.decode(value),
  },
  createGraphType: {
    path: "/gql.CatalogService/CreateGraphType",
    requestStream: false,
    responseStream: false,
    requestSerialize: (value: CreateGraphTypeRequest): Buffer =>
      Buffer.from(CreateGraphTypeRequest.encode(value).finish()),
    requestDeserialize: (value: Buffer): CreateGraphTypeRequest => CreateGraphTypeRequest.decode(value),
    responseSerialize: (value: CreateGraphTypeResponse): Buffer =>
      Buffer.from(CreateGraphTypeResponse.encode(value).finish()),
    responseDeserialize: (value: Buffer): CreateGraphTypeResponse => CreateGraphTypeResponse.decode(value),
  },
  dropGraphType: {
    path: "/gql.CatalogService/DropGraphType",
    requestStream: false,
    responseStream: false,
    requestSerialize: (value: DropGraphTypeRequest): Buffer => Buffer.from(DropGraphTypeRequest.encode(value).finish()),
    requestDeserialize: (value: Buffer): DropGraphTypeRequest => DropGraphTypeRequest.decode(value),
    responseSerialize: (value: DropGraphTypeResponse): Buffer =>
      Buffer.from(DropGraphTypeResponse.encode(value).finish()),
    responseDeserialize: (value: Buffer): DropGraphTypeResponse => DropGraphTypeResponse.decode(value),
  },
} as const;

export interface CatalogServiceServer extends UntypedServiceImplementation {
  /** Schema management (sec 12.2, 12.3 - Feature GC01) */
  listSchemas: handleUnaryCall<ListSchemasRequest, ListSchemasResponse>;
  createSchema: handleUnaryCall<CreateSchemaRequest, CreateSchemaResponse>;
  dropSchema: handleUnaryCall<DropSchemaRequest, DropSchemaResponse>;
  /** Graph management (sec 12.4, 12.5 - Feature GC04) */
  listGraphs: handleUnaryCall<ListGraphsRequest, ListGraphsResponse>;
  createGraph: handleUnaryCall<CreateGraphRequest, CreateGraphResponse>;
  dropGraph: handleUnaryCall<DropGraphRequest, DropGraphResponse>;
  getGraphInfo: handleUnaryCall<GetGraphInfoRequest, GetGraphInfoResponse>;
  /** Graph type management (sec 12.6, 12.7 - Feature GG02) */
  listGraphTypes: handleUnaryCall<ListGraphTypesRequest, ListGraphTypesResponse>;
  createGraphType: handleUnaryCall<CreateGraphTypeRequest, CreateGraphTypeResponse>;
  dropGraphType: handleUnaryCall<DropGraphTypeRequest, DropGraphTypeResponse>;
}

export interface CatalogServiceClient extends Client {
  /** Schema management (sec 12.2, 12.3 - Feature GC01) */
  listSchemas(
    request: ListSchemasRequest,
    callback: (error: ServiceError | null, response: ListSchemasResponse) => void,
  ): ClientUnaryCall;
  listSchemas(
    request: ListSchemasRequest,
    metadata: Metadata,
    callback: (error: ServiceError | null, response: ListSchemasResponse) => void,
  ): ClientUnaryCall;
  listSchemas(
    request: ListSchemasRequest,
    metadata: Metadata,
    options: Partial<CallOptions>,
    callback: (error: ServiceError | null, response: ListSchemasResponse) => void,
  ): ClientUnaryCall;
  createSchema(
    request: CreateSchemaRequest,
    callback: (error: ServiceError | null, response: CreateSchemaResponse) => void,
  ): ClientUnaryCall;
  createSchema(
    request: CreateSchemaRequest,
    metadata: Metadata,
    callback: (error: ServiceError | null, response: CreateSchemaResponse) => void,
  ): ClientUnaryCall;
  createSchema(
    request: CreateSchemaRequest,
    metadata: Metadata,
    options: Partial<CallOptions>,
    callback: (error: ServiceError | null, response: CreateSchemaResponse) => void,
  ): ClientUnaryCall;
  dropSchema(
    request: DropSchemaRequest,
    callback: (error: ServiceError | null, response: DropSchemaResponse) => void,
  ): ClientUnaryCall;
  dropSchema(
    request: DropSchemaRequest,
    metadata: Metadata,
    callback: (error: ServiceError | null, response: DropSchemaResponse) => void,
  ): ClientUnaryCall;
  dropSchema(
    request: DropSchemaRequest,
    metadata: Metadata,
    options: Partial<CallOptions>,
    callback: (error: ServiceError | null, response: DropSchemaResponse) => void,
  ): ClientUnaryCall;
  /** Graph management (sec 12.4, 12.5 - Feature GC04) */
  listGraphs(
    request: ListGraphsRequest,
    callback: (error: ServiceError | null, response: ListGraphsResponse) => void,
  ): ClientUnaryCall;
  listGraphs(
    request: ListGraphsRequest,
    metadata: Metadata,
    callback: (error: ServiceError | null, response: ListGraphsResponse) => void,
  ): ClientUnaryCall;
  listGraphs(
    request: ListGraphsRequest,
    metadata: Metadata,
    options: Partial<CallOptions>,
    callback: (error: ServiceError | null, response: ListGraphsResponse) => void,
  ): ClientUnaryCall;
  createGraph(
    request: CreateGraphRequest,
    callback: (error: ServiceError | null, response: CreateGraphResponse) => void,
  ): ClientUnaryCall;
  createGraph(
    request: CreateGraphRequest,
    metadata: Metadata,
    callback: (error: ServiceError | null, response: CreateGraphResponse) => void,
  ): ClientUnaryCall;
  createGraph(
    request: CreateGraphRequest,
    metadata: Metadata,
    options: Partial<CallOptions>,
    callback: (error: ServiceError | null, response: CreateGraphResponse) => void,
  ): ClientUnaryCall;
  dropGraph(
    request: DropGraphRequest,
    callback: (error: ServiceError | null, response: DropGraphResponse) => void,
  ): ClientUnaryCall;
  dropGraph(
    request: DropGraphRequest,
    metadata: Metadata,
    callback: (error: ServiceError | null, response: DropGraphResponse) => void,
  ): ClientUnaryCall;
  dropGraph(
    request: DropGraphRequest,
    metadata: Metadata,
    options: Partial<CallOptions>,
    callback: (error: ServiceError | null, response: DropGraphResponse) => void,
  ): ClientUnaryCall;
  getGraphInfo(
    request: GetGraphInfoRequest,
    callback: (error: ServiceError | null, response: GetGraphInfoResponse) => void,
  ): ClientUnaryCall;
  getGraphInfo(
    request: GetGraphInfoRequest,
    metadata: Metadata,
    callback: (error: ServiceError | null, response: GetGraphInfoResponse) => void,
  ): ClientUnaryCall;
  getGraphInfo(
    request: GetGraphInfoRequest,
    metadata: Metadata,
    options: Partial<CallOptions>,
    callback: (error: ServiceError | null, response: GetGraphInfoResponse) => void,
  ): ClientUnaryCall;
  /** Graph type management (sec 12.6, 12.7 - Feature GG02) */
  listGraphTypes(
    request: ListGraphTypesRequest,
    callback: (error: ServiceError | null, response: ListGraphTypesResponse) => void,
  ): ClientUnaryCall;
  listGraphTypes(
    request: ListGraphTypesRequest,
    metadata: Metadata,
    callback: (error: ServiceError | null, response: ListGraphTypesResponse) => void,
  ): ClientUnaryCall;
  listGraphTypes(
    request: ListGraphTypesRequest,
    metadata: Metadata,
    options: Partial<CallOptions>,
    callback: (error: ServiceError | null, response: ListGraphTypesResponse) => void,
  ): ClientUnaryCall;
  createGraphType(
    request: CreateGraphTypeRequest,
    callback: (error: ServiceError | null, response: CreateGraphTypeResponse) => void,
  ): ClientUnaryCall;
  createGraphType(
    request: CreateGraphTypeRequest,
    metadata: Metadata,
    callback: (error: ServiceError | null, response: CreateGraphTypeResponse) => void,
  ): ClientUnaryCall;
  createGraphType(
    request: CreateGraphTypeRequest,
    metadata: Metadata,
    options: Partial<CallOptions>,
    callback: (error: ServiceError | null, response: CreateGraphTypeResponse) => void,
  ): ClientUnaryCall;
  dropGraphType(
    request: DropGraphTypeRequest,
    callback: (error: ServiceError | null, response: DropGraphTypeResponse) => void,
  ): ClientUnaryCall;
  dropGraphType(
    request: DropGraphTypeRequest,
    metadata: Metadata,
    callback: (error: ServiceError | null, response: DropGraphTypeResponse) => void,
  ): ClientUnaryCall;
  dropGraphType(
    request: DropGraphTypeRequest,
    metadata: Metadata,
    options: Partial<CallOptions>,
    callback: (error: ServiceError | null, response: DropGraphTypeResponse) => void,
  ): ClientUnaryCall;
}

export const CatalogServiceClient = makeGenericClientConstructor(
  CatalogServiceService,
  "gql.CatalogService",
) as unknown as {
  new (address: string, credentials: ChannelCredentials, options?: Partial<ClientOptions>): CatalogServiceClient;
  service: typeof CatalogServiceService;
  serviceName: string;
};

export type AdminServiceService = typeof AdminServiceService;
export const AdminServiceService = {
  /** Get detailed graph statistics (counts, memory, disk, indexes). */
  getGraphStats: {
    path: "/gql.AdminService/GetGraphStats",
    requestStream: false,
    responseStream: false,
    requestSerialize: (value: GetGraphStatsRequest): Buffer => Buffer.from(GetGraphStatsRequest.encode(value).finish()),
    requestDeserialize: (value: Buffer): GetGraphStatsRequest => GetGraphStatsRequest.decode(value),
    responseSerialize: (value: GetGraphStatsResponse): Buffer =>
      Buffer.from(GetGraphStatsResponse.encode(value).finish()),
    responseDeserialize: (value: Buffer): GetGraphStatsResponse => GetGraphStatsResponse.decode(value),
  },
  /** Get WAL (Write-Ahead Log) status. */
  walStatus: {
    path: "/gql.AdminService/WalStatus",
    requestStream: false,
    responseStream: false,
    requestSerialize: (value: WalStatusRequest): Buffer => Buffer.from(WalStatusRequest.encode(value).finish()),
    requestDeserialize: (value: Buffer): WalStatusRequest => WalStatusRequest.decode(value),
    responseSerialize: (value: WalStatusResponse): Buffer => Buffer.from(WalStatusResponse.encode(value).finish()),
    responseDeserialize: (value: Buffer): WalStatusResponse => WalStatusResponse.decode(value),
  },
  /** Force a WAL checkpoint (flush pending records to storage). */
  walCheckpoint: {
    path: "/gql.AdminService/WalCheckpoint",
    requestStream: false,
    responseStream: false,
    requestSerialize: (value: WalCheckpointRequest): Buffer => Buffer.from(WalCheckpointRequest.encode(value).finish()),
    requestDeserialize: (value: Buffer): WalCheckpointRequest => WalCheckpointRequest.decode(value),
    responseSerialize: (value: WalCheckpointResponse): Buffer =>
      Buffer.from(WalCheckpointResponse.encode(value).finish()),
    responseDeserialize: (value: Buffer): WalCheckpointResponse => WalCheckpointResponse.decode(value),
  },
  /** Validate graph integrity (dangling edges, index consistency). */
  validate: {
    path: "/gql.AdminService/Validate",
    requestStream: false,
    responseStream: false,
    requestSerialize: (value: ValidateRequest): Buffer => Buffer.from(ValidateRequest.encode(value).finish()),
    requestDeserialize: (value: Buffer): ValidateRequest => ValidateRequest.decode(value),
    responseSerialize: (value: ValidateResponse): Buffer => Buffer.from(ValidateResponse.encode(value).finish()),
    responseDeserialize: (value: Buffer): ValidateResponse => ValidateResponse.decode(value),
  },
  /** Create an index (property, vector, or text). */
  createIndex: {
    path: "/gql.AdminService/CreateIndex",
    requestStream: false,
    responseStream: false,
    requestSerialize: (value: CreateIndexRequest): Buffer => Buffer.from(CreateIndexRequest.encode(value).finish()),
    requestDeserialize: (value: Buffer): CreateIndexRequest => CreateIndexRequest.decode(value),
    responseSerialize: (value: CreateIndexResponse): Buffer => Buffer.from(CreateIndexResponse.encode(value).finish()),
    responseDeserialize: (value: Buffer): CreateIndexResponse => CreateIndexResponse.decode(value),
  },
  /** Drop an index. */
  dropIndex: {
    path: "/gql.AdminService/DropIndex",
    requestStream: false,
    responseStream: false,
    requestSerialize: (value: DropIndexRequest): Buffer => Buffer.from(DropIndexRequest.encode(value).finish()),
    requestDeserialize: (value: Buffer): DropIndexRequest => DropIndexRequest.decode(value),
    responseSerialize: (value: DropIndexResponse): Buffer => Buffer.from(DropIndexResponse.encode(value).finish()),
    responseDeserialize: (value: Buffer): DropIndexResponse => DropIndexResponse.decode(value),
  },
} as const;

export interface AdminServiceServer extends UntypedServiceImplementation {
  /** Get detailed graph statistics (counts, memory, disk, indexes). */
  getGraphStats: handleUnaryCall<GetGraphStatsRequest, GetGraphStatsResponse>;
  /** Get WAL (Write-Ahead Log) status. */
  walStatus: handleUnaryCall<WalStatusRequest, WalStatusResponse>;
  /** Force a WAL checkpoint (flush pending records to storage). */
  walCheckpoint: handleUnaryCall<WalCheckpointRequest, WalCheckpointResponse>;
  /** Validate graph integrity (dangling edges, index consistency). */
  validate: handleUnaryCall<ValidateRequest, ValidateResponse>;
  /** Create an index (property, vector, or text). */
  createIndex: handleUnaryCall<CreateIndexRequest, CreateIndexResponse>;
  /** Drop an index. */
  dropIndex: handleUnaryCall<DropIndexRequest, DropIndexResponse>;
}

export interface AdminServiceClient extends Client {
  /** Get detailed graph statistics (counts, memory, disk, indexes). */
  getGraphStats(
    request: GetGraphStatsRequest,
    callback: (error: ServiceError | null, response: GetGraphStatsResponse) => void,
  ): ClientUnaryCall;
  getGraphStats(
    request: GetGraphStatsRequest,
    metadata: Metadata,
    callback: (error: ServiceError | null, response: GetGraphStatsResponse) => void,
  ): ClientUnaryCall;
  getGraphStats(
    request: GetGraphStatsRequest,
    metadata: Metadata,
    options: Partial<CallOptions>,
    callback: (error: ServiceError | null, response: GetGraphStatsResponse) => void,
  ): ClientUnaryCall;
  /** Get WAL (Write-Ahead Log) status. */
  walStatus(
    request: WalStatusRequest,
    callback: (error: ServiceError | null, response: WalStatusResponse) => void,
  ): ClientUnaryCall;
  walStatus(
    request: WalStatusRequest,
    metadata: Metadata,
    callback: (error: ServiceError | null, response: WalStatusResponse) => void,
  ): ClientUnaryCall;
  walStatus(
    request: WalStatusRequest,
    metadata: Metadata,
    options: Partial<CallOptions>,
    callback: (error: ServiceError | null, response: WalStatusResponse) => void,
  ): ClientUnaryCall;
  /** Force a WAL checkpoint (flush pending records to storage). */
  walCheckpoint(
    request: WalCheckpointRequest,
    callback: (error: ServiceError | null, response: WalCheckpointResponse) => void,
  ): ClientUnaryCall;
  walCheckpoint(
    request: WalCheckpointRequest,
    metadata: Metadata,
    callback: (error: ServiceError | null, response: WalCheckpointResponse) => void,
  ): ClientUnaryCall;
  walCheckpoint(
    request: WalCheckpointRequest,
    metadata: Metadata,
    options: Partial<CallOptions>,
    callback: (error: ServiceError | null, response: WalCheckpointResponse) => void,
  ): ClientUnaryCall;
  /** Validate graph integrity (dangling edges, index consistency). */
  validate(
    request: ValidateRequest,
    callback: (error: ServiceError | null, response: ValidateResponse) => void,
  ): ClientUnaryCall;
  validate(
    request: ValidateRequest,
    metadata: Metadata,
    callback: (error: ServiceError | null, response: ValidateResponse) => void,
  ): ClientUnaryCall;
  validate(
    request: ValidateRequest,
    metadata: Metadata,
    options: Partial<CallOptions>,
    callback: (error: ServiceError | null, response: ValidateResponse) => void,
  ): ClientUnaryCall;
  /** Create an index (property, vector, or text). */
  createIndex(
    request: CreateIndexRequest,
    callback: (error: ServiceError | null, response: CreateIndexResponse) => void,
  ): ClientUnaryCall;
  createIndex(
    request: CreateIndexRequest,
    metadata: Metadata,
    callback: (error: ServiceError | null, response: CreateIndexResponse) => void,
  ): ClientUnaryCall;
  createIndex(
    request: CreateIndexRequest,
    metadata: Metadata,
    options: Partial<CallOptions>,
    callback: (error: ServiceError | null, response: CreateIndexResponse) => void,
  ): ClientUnaryCall;
  /** Drop an index. */
  dropIndex(
    request: DropIndexRequest,
    callback: (error: ServiceError | null, response: DropIndexResponse) => void,
  ): ClientUnaryCall;
  dropIndex(
    request: DropIndexRequest,
    metadata: Metadata,
    callback: (error: ServiceError | null, response: DropIndexResponse) => void,
  ): ClientUnaryCall;
  dropIndex(
    request: DropIndexRequest,
    metadata: Metadata,
    options: Partial<CallOptions>,
    callback: (error: ServiceError | null, response: DropIndexResponse) => void,
  ): ClientUnaryCall;
}

export const AdminServiceClient = makeGenericClientConstructor(AdminServiceService, "gql.AdminService") as unknown as {
  new (address: string, credentials: ChannelCredentials, options?: Partial<ClientOptions>): AdminServiceClient;
  service: typeof AdminServiceService;
  serviceName: string;
};

export type SearchServiceService = typeof SearchServiceService;
export const SearchServiceService = {
  /** Vector similarity search (KNN via HNSW index). */
  vectorSearch: {
    path: "/gql.SearchService/VectorSearch",
    requestStream: false,
    responseStream: false,
    requestSerialize: (value: VectorSearchRequest): Buffer => Buffer.from(VectorSearchRequest.encode(value).finish()),
    requestDeserialize: (value: Buffer): VectorSearchRequest => VectorSearchRequest.decode(value),
    responseSerialize: (value: VectorSearchResponse): Buffer =>
      Buffer.from(VectorSearchResponse.encode(value).finish()),
    responseDeserialize: (value: Buffer): VectorSearchResponse => VectorSearchResponse.decode(value),
  },
  /** Full-text search (BM25 scoring). */
  textSearch: {
    path: "/gql.SearchService/TextSearch",
    requestStream: false,
    responseStream: false,
    requestSerialize: (value: TextSearchRequest): Buffer => Buffer.from(TextSearchRequest.encode(value).finish()),
    requestDeserialize: (value: Buffer): TextSearchRequest => TextSearchRequest.decode(value),
    responseSerialize: (value: TextSearchResponse): Buffer => Buffer.from(TextSearchResponse.encode(value).finish()),
    responseDeserialize: (value: Buffer): TextSearchResponse => TextSearchResponse.decode(value),
  },
  /** Hybrid search combining text and vector results with rank fusion. */
  hybridSearch: {
    path: "/gql.SearchService/HybridSearch",
    requestStream: false,
    responseStream: false,
    requestSerialize: (value: HybridSearchRequest): Buffer => Buffer.from(HybridSearchRequest.encode(value).finish()),
    requestDeserialize: (value: Buffer): HybridSearchRequest => HybridSearchRequest.decode(value),
    responseSerialize: (value: HybridSearchResponse): Buffer =>
      Buffer.from(HybridSearchResponse.encode(value).finish()),
    responseDeserialize: (value: Buffer): HybridSearchResponse => HybridSearchResponse.decode(value),
  },
} as const;

export interface SearchServiceServer extends UntypedServiceImplementation {
  /** Vector similarity search (KNN via HNSW index). */
  vectorSearch: handleUnaryCall<VectorSearchRequest, VectorSearchResponse>;
  /** Full-text search (BM25 scoring). */
  textSearch: handleUnaryCall<TextSearchRequest, TextSearchResponse>;
  /** Hybrid search combining text and vector results with rank fusion. */
  hybridSearch: handleUnaryCall<HybridSearchRequest, HybridSearchResponse>;
}

export interface SearchServiceClient extends Client {
  /** Vector similarity search (KNN via HNSW index). */
  vectorSearch(
    request: VectorSearchRequest,
    callback: (error: ServiceError | null, response: VectorSearchResponse) => void,
  ): ClientUnaryCall;
  vectorSearch(
    request: VectorSearchRequest,
    metadata: Metadata,
    callback: (error: ServiceError | null, response: VectorSearchResponse) => void,
  ): ClientUnaryCall;
  vectorSearch(
    request: VectorSearchRequest,
    metadata: Metadata,
    options: Partial<CallOptions>,
    callback: (error: ServiceError | null, response: VectorSearchResponse) => void,
  ): ClientUnaryCall;
  /** Full-text search (BM25 scoring). */
  textSearch(
    request: TextSearchRequest,
    callback: (error: ServiceError | null, response: TextSearchResponse) => void,
  ): ClientUnaryCall;
  textSearch(
    request: TextSearchRequest,
    metadata: Metadata,
    callback: (error: ServiceError | null, response: TextSearchResponse) => void,
  ): ClientUnaryCall;
  textSearch(
    request: TextSearchRequest,
    metadata: Metadata,
    options: Partial<CallOptions>,
    callback: (error: ServiceError | null, response: TextSearchResponse) => void,
  ): ClientUnaryCall;
  /** Hybrid search combining text and vector results with rank fusion. */
  hybridSearch(
    request: HybridSearchRequest,
    callback: (error: ServiceError | null, response: HybridSearchResponse) => void,
  ): ClientUnaryCall;
  hybridSearch(
    request: HybridSearchRequest,
    metadata: Metadata,
    callback: (error: ServiceError | null, response: HybridSearchResponse) => void,
  ): ClientUnaryCall;
  hybridSearch(
    request: HybridSearchRequest,
    metadata: Metadata,
    options: Partial<CallOptions>,
    callback: (error: ServiceError | null, response: HybridSearchResponse) => void,
  ): ClientUnaryCall;
}

export const SearchServiceClient = makeGenericClientConstructor(
  SearchServiceService,
  "gql.SearchService",
) as unknown as {
  new (address: string, credentials: ChannelCredentials, options?: Partial<ClientOptions>): SearchServiceClient;
  service: typeof SearchServiceService;
  serviceName: string;
};

type Builtin = Date | Function | Uint8Array | string | number | boolean | bigint | undefined;

export type DeepPartial<T> = T extends Builtin ? T
  : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
  : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
  : T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
  : Partial<T>;

type KeysOfUnion<T> = T extends T ? keyof T : never;
export type Exact<P, I extends P> = P extends Builtin ? P
  : P & { [K in keyof P]: Exact<P[K], I[K]> } & { [K in Exclude<keyof I, KeysOfUnion<P>>]: never };

function isObject(value: any): boolean {
  return typeof value === "object" && value !== null;
}

function isSet(value: any): boolean {
  return value !== null && value !== undefined;
}

export interface MessageFns<T> {
  encode(message: T, writer?: BinaryWriter): BinaryWriter;
  decode(input: BinaryReader | Uint8Array, length?: number): T;
  fromJSON(object: any): T;
  toJSON(message: T): unknown;
  create<I extends Exact<DeepPartial<T>, I>>(base?: I): T;
  fromPartial<I extends Exact<DeepPartial<T>, I>>(object: I): T;
}
