// Copyright 2022 Luca Casonato. All rights reserved. MIT license.
/**
 * Agent Registry API Client for Deno
 * ==================================
 * 
 * Agent Registry is a centralized, unified catalog that lets you store, discover, and govern Model Context Protocol (MCP) servers, tools, and AI agents within Google Cloud.
 * 
 * Docs: https://docs.cloud.google.com/agent-registry/overview
 * Source: https://googleapis.deno.dev/v1/agentregistry:v1.ts
 */

import { auth, CredentialsClient, GoogleAuth, request } from "/_/base@v1/mod.ts";
export { auth, GoogleAuth };
export type { CredentialsClient };

/**
 * Agent Registry is a centralized, unified catalog that lets you store,
 * discover, and govern Model Context Protocol (MCP) servers, tools, and AI
 * agents within Google Cloud.
 */
export class AgentRegistry {
  #client: CredentialsClient | undefined;
  #baseUrl: string;

  constructor(client?: CredentialsClient, baseUrl: string = "https://agentregistry.googleapis.com/") {
    this.#client = client;
    this.#baseUrl = baseUrl;
  }

  /**
   * Gets details of a single Agent.
   *
   * @param name Required. Name of the resource
   */
  async projectsLocationsAgentsGet(name: string): Promise<Agent> {
    const url = new URL(`${this.#baseUrl}v1/${ name }`);
    const data = await request(url.href, {
      client: this.#client,
      method: "GET",
    });
    return data as Agent;
  }

  /**
   * Lists Agents in a given project and location.
   *
   * @param parent Required. Parent value for ListAgentsRequest
   */
  async projectsLocationsAgentsList(parent: string, opts: ProjectsLocationsAgentsListOptions = {}): Promise<ListAgentsResponse> {
    const url = new URL(`${this.#baseUrl}v1/${ parent }/agents`);
    if (opts.filter !== undefined) {
      url.searchParams.append("filter", String(opts.filter));
    }
    if (opts.orderBy !== undefined) {
      url.searchParams.append("orderBy", String(opts.orderBy));
    }
    if (opts.pageSize !== undefined) {
      url.searchParams.append("pageSize", String(opts.pageSize));
    }
    if (opts.pageToken !== undefined) {
      url.searchParams.append("pageToken", String(opts.pageToken));
    }
    const data = await request(url.href, {
      client: this.#client,
      method: "GET",
    });
    return data as ListAgentsResponse;
  }

  /**
   * Searches Agents in a given project and location.
   *
   * @param parent Required. Parent value for SearchAgentsRequest. Format: `projects/{project}/locations/{location}`.
   */
  async projectsLocationsAgentsSearch(parent: string, req: SearchAgentsRequest): Promise<SearchAgentsResponse> {
    const url = new URL(`${this.#baseUrl}v1/${ parent }/agents:search`);
    const body = JSON.stringify(req);
    const data = await request(url.href, {
      client: this.#client,
      method: "POST",
      body,
    });
    return data as SearchAgentsResponse;
  }

  /**
   * Creates a new Binding in a given project and location.
   *
   * @param parent Required. The project and location to create the Binding in. Expected format: `projects/{project}/locations/{location}`.
   */
  async projectsLocationsBindingsCreate(parent: string, req: Binding, opts: ProjectsLocationsBindingsCreateOptions = {}): Promise<Operation> {
    const url = new URL(`${this.#baseUrl}v1/${ parent }/bindings`);
    if (opts.bindingId !== undefined) {
      url.searchParams.append("bindingId", String(opts.bindingId));
    }
    if (opts.requestId !== undefined) {
      url.searchParams.append("requestId", String(opts.requestId));
    }
    const body = JSON.stringify(req);
    const data = await request(url.href, {
      client: this.#client,
      method: "POST",
      body,
    });
    return data as Operation;
  }

  /**
   * Deletes a single Binding.
   *
   * @param name Required. The name of the Binding. Format: `projects/{project}/locations/{location}/bindings/{binding}`.
   */
  async projectsLocationsBindingsDelete(name: string, opts: ProjectsLocationsBindingsDeleteOptions = {}): Promise<Operation> {
    const url = new URL(`${this.#baseUrl}v1/${ name }`);
    if (opts.requestId !== undefined) {
      url.searchParams.append("requestId", String(opts.requestId));
    }
    const data = await request(url.href, {
      client: this.#client,
      method: "DELETE",
    });
    return data as Operation;
  }

  /**
   * Fetches available Bindings.
   *
   * @param parent Required. The parent, in the format `projects/{project}/locations/{location}`.
   */
  async projectsLocationsBindingsFetchAvailable(parent: string, opts: ProjectsLocationsBindingsFetchAvailableOptions = {}): Promise<FetchAvailableBindingsResponse> {
    const url = new URL(`${this.#baseUrl}v1/${ parent }/bindings:fetchAvailable`);
    if (opts.pageSize !== undefined) {
      url.searchParams.append("pageSize", String(opts.pageSize));
    }
    if (opts.pageToken !== undefined) {
      url.searchParams.append("pageToken", String(opts.pageToken));
    }
    if (opts.sourceIdentifier !== undefined) {
      url.searchParams.append("sourceIdentifier", String(opts.sourceIdentifier));
    }
    if (opts.targetIdentifier !== undefined) {
      url.searchParams.append("targetIdentifier", String(opts.targetIdentifier));
    }
    const data = await request(url.href, {
      client: this.#client,
      method: "GET",
    });
    return data as FetchAvailableBindingsResponse;
  }

  /**
   * Gets details of a single Binding.
   *
   * @param name Required. The name of the Binding. Format: `projects/{project}/locations/{location}/bindings/{binding}`.
   */
  async projectsLocationsBindingsGet(name: string): Promise<Binding> {
    const url = new URL(`${this.#baseUrl}v1/${ name }`);
    const data = await request(url.href, {
      client: this.#client,
      method: "GET",
    });
    return data as Binding;
  }

  /**
   * Lists Bindings in a given project and location.
   *
   * @param parent Required. The project and location to list bindings in. Expected format: `projects/{project}/locations/{location}`.
   */
  async projectsLocationsBindingsList(parent: string, opts: ProjectsLocationsBindingsListOptions = {}): Promise<ListBindingsResponse> {
    const url = new URL(`${this.#baseUrl}v1/${ parent }/bindings`);
    if (opts.filter !== undefined) {
      url.searchParams.append("filter", String(opts.filter));
    }
    if (opts.orderBy !== undefined) {
      url.searchParams.append("orderBy", String(opts.orderBy));
    }
    if (opts.pageSize !== undefined) {
      url.searchParams.append("pageSize", String(opts.pageSize));
    }
    if (opts.pageToken !== undefined) {
      url.searchParams.append("pageToken", String(opts.pageToken));
    }
    const data = await request(url.href, {
      client: this.#client,
      method: "GET",
    });
    return data as ListBindingsResponse;
  }

  /**
   * Updates the parameters of a single Binding.
   *
   * @param name Required. Identifier. The resource name of the Binding. Format: `projects/{project}/locations/{location}/bindings/{binding}`.
   */
  async projectsLocationsBindingsPatch(name: string, req: Binding, opts: ProjectsLocationsBindingsPatchOptions = {}): Promise<Operation> {
    opts = serializeProjectsLocationsBindingsPatchOptions(opts);
    const url = new URL(`${this.#baseUrl}v1/${ name }`);
    if (opts.requestId !== undefined) {
      url.searchParams.append("requestId", String(opts.requestId));
    }
    if (opts.updateMask !== undefined) {
      url.searchParams.append("updateMask", String(opts.updateMask));
    }
    const body = JSON.stringify(req);
    const data = await request(url.href, {
      client: this.#client,
      method: "PATCH",
      body,
    });
    return data as Operation;
  }

  /**
   * Gets details of a single Endpoint.
   *
   * @param name Required. The name of the endpoint to retrieve. Format: `projects/{project}/locations/{location}/endpoints/{endpoint}`
   */
  async projectsLocationsEndpointsGet(name: string): Promise<Endpoint> {
    const url = new URL(`${this.#baseUrl}v1/${ name }`);
    const data = await request(url.href, {
      client: this.#client,
      method: "GET",
    });
    return data as Endpoint;
  }

  /**
   * Lists Endpoints in a given project and location.
   *
   * @param parent Required. The project and location to list endpoints in. Expected format: `projects/{project}/locations/{location}`.
   */
  async projectsLocationsEndpointsList(parent: string, opts: ProjectsLocationsEndpointsListOptions = {}): Promise<ListEndpointsResponse> {
    const url = new URL(`${this.#baseUrl}v1/${ parent }/endpoints`);
    if (opts.filter !== undefined) {
      url.searchParams.append("filter", String(opts.filter));
    }
    if (opts.pageSize !== undefined) {
      url.searchParams.append("pageSize", String(opts.pageSize));
    }
    if (opts.pageToken !== undefined) {
      url.searchParams.append("pageToken", String(opts.pageToken));
    }
    const data = await request(url.href, {
      client: this.#client,
      method: "GET",
    });
    return data as ListEndpointsResponse;
  }

  /**
   * Gets information about a location.
   *
   * @param name Resource name for the location.
   */
  async projectsLocationsGet(name: string): Promise<Location> {
    const url = new URL(`${this.#baseUrl}v1/${ name }`);
    const data = await request(url.href, {
      client: this.#client,
      method: "GET",
    });
    return data as Location;
  }

  /**
   * Lists information about the supported locations for this service. This
   * method lists locations based on the resource scope provided in the
   * ListLocationsRequest.name field: * **Global locations**: If `name` is
   * empty, the method lists the public locations available to all projects. *
   * **Project-specific locations**: If `name` follows the format
   * `projects/{project}`, the method lists locations visible to that specific
   * project. This includes public, private, or other project-specific locations
   * enabled for the project. For gRPC and client library implementations, the
   * resource name is passed as the `name` field. For direct service calls, the
   * resource name is incorporated into the request path based on the specific
   * service implementation and version.
   *
   * @param name The resource that owns the locations collection, if applicable.
   */
  async projectsLocationsList(name: string, opts: ProjectsLocationsListOptions = {}): Promise<ListLocationsResponse> {
    const url = new URL(`${this.#baseUrl}v1/${ name }/locations`);
    if (opts.extraLocationTypes !== undefined) {
      url.searchParams.append("extraLocationTypes", String(opts.extraLocationTypes));
    }
    if (opts.filter !== undefined) {
      url.searchParams.append("filter", String(opts.filter));
    }
    if (opts.pageSize !== undefined) {
      url.searchParams.append("pageSize", String(opts.pageSize));
    }
    if (opts.pageToken !== undefined) {
      url.searchParams.append("pageToken", String(opts.pageToken));
    }
    const data = await request(url.href, {
      client: this.#client,
      method: "GET",
    });
    return data as ListLocationsResponse;
  }

  /**
   * Gets details of a single McpServer.
   *
   * @param name Required. Name of the resource
   */
  async projectsLocationsMcpServersGet(name: string): Promise<McpServer> {
    const url = new URL(`${this.#baseUrl}v1/${ name }`);
    const data = await request(url.href, {
      client: this.#client,
      method: "GET",
    });
    return data as McpServer;
  }

  /**
   * Lists McpServers in a given project and location.
   *
   * @param parent Required. Parent value for ListMcpServersRequest. Format: `projects/{project}/locations/{location}`.
   */
  async projectsLocationsMcpServersList(parent: string, opts: ProjectsLocationsMcpServersListOptions = {}): Promise<ListMcpServersResponse> {
    const url = new URL(`${this.#baseUrl}v1/${ parent }/mcpServers`);
    if (opts.filter !== undefined) {
      url.searchParams.append("filter", String(opts.filter));
    }
    if (opts.orderBy !== undefined) {
      url.searchParams.append("orderBy", String(opts.orderBy));
    }
    if (opts.pageSize !== undefined) {
      url.searchParams.append("pageSize", String(opts.pageSize));
    }
    if (opts.pageToken !== undefined) {
      url.searchParams.append("pageToken", String(opts.pageToken));
    }
    const data = await request(url.href, {
      client: this.#client,
      method: "GET",
    });
    return data as ListMcpServersResponse;
  }

  /**
   * Searches McpServers in a given project and location.
   *
   * @param parent Required. Parent value for SearchMcpServersRequest. Format: `projects/{project}/locations/{location}`.
   */
  async projectsLocationsMcpServersSearch(parent: string, req: SearchMcpServersRequest): Promise<SearchMcpServersResponse> {
    const url = new URL(`${this.#baseUrl}v1/${ parent }/mcpServers:search`);
    const body = JSON.stringify(req);
    const data = await request(url.href, {
      client: this.#client,
      method: "POST",
      body,
    });
    return data as SearchMcpServersResponse;
  }

  /**
   * Starts asynchronous cancellation on a long-running operation. The server
   * makes a best effort to cancel the operation, but success is not guaranteed.
   * If the server doesn't support this method, it returns
   * `google.rpc.Code.UNIMPLEMENTED`. Clients can use Operations.GetOperation or
   * other methods to check whether the cancellation succeeded or whether the
   * operation completed despite cancellation. On successful cancellation, the
   * operation is not deleted; instead, it becomes an operation with an
   * Operation.error value with a google.rpc.Status.code of `1`, corresponding
   * to `Code.CANCELLED`.
   *
   * @param name The name of the operation resource to be cancelled.
   */
  async projectsLocationsOperationsCancel(name: string, req: CancelOperationRequest): Promise<Empty> {
    const url = new URL(`${this.#baseUrl}v1/${ name }:cancel`);
    const body = JSON.stringify(req);
    const data = await request(url.href, {
      client: this.#client,
      method: "POST",
      body,
    });
    return data as Empty;
  }

  /**
   * Deletes a long-running operation. This method indicates that the client is
   * no longer interested in the operation result. It does not cancel the
   * operation. If the server doesn't support this method, it returns
   * `google.rpc.Code.UNIMPLEMENTED`.
   *
   * @param name The name of the operation resource to be deleted.
   */
  async projectsLocationsOperationsDelete(name: string): Promise<Empty> {
    const url = new URL(`${this.#baseUrl}v1/${ name }`);
    const data = await request(url.href, {
      client: this.#client,
      method: "DELETE",
    });
    return data as Empty;
  }

  /**
   * Gets the latest state of a long-running operation. Clients can use this
   * method to poll the operation result at intervals as recommended by the API
   * service.
   *
   * @param name The name of the operation resource.
   */
  async projectsLocationsOperationsGet(name: string): Promise<Operation> {
    const url = new URL(`${this.#baseUrl}v1/${ name }`);
    const data = await request(url.href, {
      client: this.#client,
      method: "GET",
    });
    return data as Operation;
  }

  /**
   * Lists operations that match the specified filter in the request. If the
   * server doesn't support this method, it returns `UNIMPLEMENTED`.
   *
   * @param name The name of the operation's parent resource.
   */
  async projectsLocationsOperationsList(name: string, opts: ProjectsLocationsOperationsListOptions = {}): Promise<ListOperationsResponse> {
    const url = new URL(`${this.#baseUrl}v1/${ name }/operations`);
    if (opts.filter !== undefined) {
      url.searchParams.append("filter", String(opts.filter));
    }
    if (opts.pageSize !== undefined) {
      url.searchParams.append("pageSize", String(opts.pageSize));
    }
    if (opts.pageToken !== undefined) {
      url.searchParams.append("pageToken", String(opts.pageToken));
    }
    if (opts.returnPartialSuccess !== undefined) {
      url.searchParams.append("returnPartialSuccess", String(opts.returnPartialSuccess));
    }
    const data = await request(url.href, {
      client: this.#client,
      method: "GET",
    });
    return data as ListOperationsResponse;
  }

  /**
   * Creates a new Service in a given project and location.
   *
   * @param parent Required. The project and location to create the Service in. Expected format: `projects/{project}/locations/{location}`.
   */
  async projectsLocationsServicesCreate(parent: string, req: Service, opts: ProjectsLocationsServicesCreateOptions = {}): Promise<Operation> {
    const url = new URL(`${this.#baseUrl}v1/${ parent }/services`);
    if (opts.requestId !== undefined) {
      url.searchParams.append("requestId", String(opts.requestId));
    }
    if (opts.serviceId !== undefined) {
      url.searchParams.append("serviceId", String(opts.serviceId));
    }
    const body = JSON.stringify(req);
    const data = await request(url.href, {
      client: this.#client,
      method: "POST",
      body,
    });
    return data as Operation;
  }

  /**
   * Deletes a single Service.
   *
   * @param name Required. The name of the Service. Format: `projects/{project}/locations/{location}/services/{service}`.
   */
  async projectsLocationsServicesDelete(name: string, opts: ProjectsLocationsServicesDeleteOptions = {}): Promise<Operation> {
    const url = new URL(`${this.#baseUrl}v1/${ name }`);
    if (opts.requestId !== undefined) {
      url.searchParams.append("requestId", String(opts.requestId));
    }
    const data = await request(url.href, {
      client: this.#client,
      method: "DELETE",
    });
    return data as Operation;
  }

  /**
   * Gets details of a single Service.
   *
   * @param name Required. The name of the Service. Format: `projects/{project}/locations/{location}/services/{service}`.
   */
  async projectsLocationsServicesGet(name: string): Promise<Service> {
    const url = new URL(`${this.#baseUrl}v1/${ name }`);
    const data = await request(url.href, {
      client: this.#client,
      method: "GET",
    });
    return data as Service;
  }

  /**
   * Lists Services in a given project and location.
   *
   * @param parent Required. The project and location to list services in. Expected format: `projects/{project}/locations/{location}`.
   */
  async projectsLocationsServicesList(parent: string, opts: ProjectsLocationsServicesListOptions = {}): Promise<ListServicesResponse> {
    const url = new URL(`${this.#baseUrl}v1/${ parent }/services`);
    if (opts.filter !== undefined) {
      url.searchParams.append("filter", String(opts.filter));
    }
    if (opts.pageSize !== undefined) {
      url.searchParams.append("pageSize", String(opts.pageSize));
    }
    if (opts.pageToken !== undefined) {
      url.searchParams.append("pageToken", String(opts.pageToken));
    }
    const data = await request(url.href, {
      client: this.#client,
      method: "GET",
    });
    return data as ListServicesResponse;
  }

  /**
   * Updates the parameters of a single Service.
   *
   * @param name Identifier. The resource name of the Service. Format: `projects/{project}/locations/{location}/services/{service}`.
   */
  async projectsLocationsServicesPatch(name: string, req: Service, opts: ProjectsLocationsServicesPatchOptions = {}): Promise<Operation> {
    opts = serializeProjectsLocationsServicesPatchOptions(opts);
    const url = new URL(`${this.#baseUrl}v1/${ name }`);
    if (opts.requestId !== undefined) {
      url.searchParams.append("requestId", String(opts.requestId));
    }
    if (opts.updateMask !== undefined) {
      url.searchParams.append("updateMask", String(opts.updateMask));
    }
    const body = JSON.stringify(req);
    const data = await request(url.href, {
      client: this.#client,
      method: "PATCH",
      body,
    });
    return data as Operation;
  }
}

/**
 * Represents the skills of an Agent.
 */
export interface A2ASkill {
  /**
   * Output only. A more detailed description of the skill.
   */
  readonly description?: string;
  /**
   * Output only. Example prompts or scenarios this skill can handle.
   */
  readonly examples?: string[];
  /**
   * Output only. A unique identifier for the agent's skill.
   */
  readonly id?: string;
  /**
   * Output only. A human-readable name for the agent's skill.
   */
  readonly name?: string;
  /**
   * Output only. Keywords describing the skill.
   */
  readonly tags?: string[];
}

/**
 * Represents an Agent. "A2A" below refers to the Agent-to-Agent protocol.
 */
export interface Agent {
  /**
   * Output only. A stable, globally unique identifier for agents.
   */
  readonly agentId?: string;
  /**
   * Output only. Attributes of the Agent. Valid values: *
   * `agentregistry.googleapis.com/system/Framework`: {"framework":
   * "google-adk"} - the agent framework used to develop the Agent. Example
   * values: "google-adk", "langchain", "custom". *
   * `agentregistry.googleapis.com/system/RuntimeIdentity`: {"principal":
   * "principal://..."} - the runtime identity associated with the Agent. *
   * `agentregistry.googleapis.com/system/RuntimeReference`: {"uri": "//..."} -
   * the URI of the underlying resource hosting the Agent, for example, the
   * Reasoning Engine URI.
   */
  readonly attributes?: {
    [key: string]: {
      [key: string]: any
    }
  };
  /**
   * Output only. Full Agent Card payload, when available.
   */
  readonly card?: Card;
  /**
   * Output only. Create time.
   */
  readonly createTime?: Date;
  /**
   * Output only. The description of the Agent, often obtained from the A2A
   * Agent Card. Empty if Agent Card has no description.
   */
  readonly description?: string;
  /**
   * Output only. The display name of the agent, often obtained from the A2A
   * Agent Card.
   */
  readonly displayName?: string;
  /**
   * Output only. The location where agent is hosted. The value is defined by
   * the hosting environment (i.e. cloud provider).
   */
  readonly location?: string;
  /**
   * Identifier. The resource name of an Agent. Format:
   * `projects/{project}/locations/{location}/agents/{agent}`.
   */
  name?: string;
  /**
   * Output only. The connection details for the Agent.
   */
  readonly protocols?: Protocol[];
  /**
   * Output only. Skills the agent possesses, often obtained from the A2A Agent
   * Card.
   */
  readonly skills?: A2ASkill[];
  /**
   * Output only. A universally unique identifier for the Agent.
   */
  readonly uid?: string;
  /**
   * Output only. Update time.
   */
  readonly updateTime?: Date;
  /**
   * Output only. The version of the Agent, often obtained from the A2A Agent
   * Card. Empty if Agent Card has no version or agent is not an A2A Agent.
   */
  readonly version?: string;
}

/**
 * The spec of the agent.
 */
export interface AgentSpec {
  /**
   * Optional. The content of the Agent spec in the JSON format. This payload
   * is validated against the schema for the specified type. The content size is
   * limited to `10KB`.
   */
  content?: {
    [key: string]: any
  };
  /**
   * Required. The type of the agent spec content.
   */
  type?:  | "TYPE_UNSPECIFIED" | "NO_SPEC" | "A2A_AGENT_CARD";
}

/**
 * Annotations describing the characteristics and behavior of a tool or
 * operation.
 */
export interface Annotations {
  /**
   * Output only. If true, the tool may perform destructive updates to its
   * environment. If false, the tool performs only additive updates. NOTE: This
   * property is meaningful only when `read_only_hint == false` Default: true
   */
  readonly destructiveHint?: boolean;
  /**
   * Output only. If true, calling the tool repeatedly with the same arguments
   * will have no additional effect on its environment. NOTE: This property is
   * meaningful only when `read_only_hint == false` Default: false
   */
  readonly idempotentHint?: boolean;
  /**
   * Output only. If true, this tool may interact with an "open world" of
   * external entities. If false, the tool's domain of interaction is closed.
   * For example, the world of a web search tool is open, whereas that of a
   * memory tool is not. Default: true
   */
  readonly openWorldHint?: boolean;
  /**
   * Output only. If true, the tool does not modify its environment. Default:
   * false
   */
  readonly readOnlyHint?: boolean;
  /**
   * Output only. A human-readable title for the tool.
   */
  readonly title?: string;
}

/**
 * The AuthProvider of the Binding.
 */
export interface AuthProviderBinding {
  /**
   * Required. The resource name of the target AuthProvider. Format: *
   * `projects/{project}/locations/{location}/authProviders/{auth_provider}`
   */
  authProvider?: string;
  /**
   * Optional. The continue URI of the AuthProvider. The URI is used to
   * reauthenticate the user and finalize the managed OAuth flow.
   */
  continueUri?: string;
  /**
   * Optional. The list of OAuth2 scopes of the AuthProvider.
   */
  scopes?: string[];
}

/**
 * Represents a user-defined Binding.
 */
export interface Binding {
  /**
   * The binding for AuthProvider.
   */
  authProviderBinding?: AuthProviderBinding;
  /**
   * Output only. Timestamp when this binding was created.
   */
  readonly createTime?: Date;
  /**
   * Optional. User-defined description of a Binding. Can have a maximum length
   * of `2048` characters.
   */
  description?: string;
  /**
   * Optional. User-defined display name for the Binding. Can have a maximum
   * length of `63` characters.
   */
  displayName?: string;
  /**
   * Required. Identifier. The resource name of the Binding. Format:
   * `projects/{project}/locations/{location}/bindings/{binding}`.
   */
  name?: string;
  /**
   * Required. The target Agent of the Binding.
   */
  source?: Source;
  /**
   * Required. The target Agent Registry Resource of the Binding.
   */
  target?: Target;
  /**
   * Output only. Timestamp when this binding was last updated.
   */
  readonly updateTime?: Date;
}

/**
 * The request message for Operations.CancelOperation.
 */
export interface CancelOperationRequest {
}

/**
 * Full Agent Card payload, often obtained from the A2A Agent Card.
 */
export interface Card {
  /**
   * Output only. The content of the agent card.
   */
  readonly content?: {
    [key: string]: any
  };
  /**
   * Output only. The type of agent card.
   */
  readonly type?:  | "TYPE_UNSPECIFIED" | "A2A_AGENT_CARD";
}

/**
 * A generic empty message that you can re-use to avoid defining duplicated
 * empty messages in your APIs. A typical example is to use it as the request or
 * the response type of an API method. For instance: service Foo { rpc
 * Bar(google.protobuf.Empty) returns (google.protobuf.Empty); }
 */
export interface Empty {
}

/**
 * Represents an Endpoint.
 */
export interface Endpoint {
  /**
   * Output only. Attributes of the Endpoint. Valid values: *
   * `agentregistry.googleapis.com/system/RuntimeReference`: {"uri": "//..."} -
   * the URI of the underlying resource hosting the Endpoint, for example, the
   * GKE Deployment.
   */
  readonly attributes?: {
    [key: string]: {
      [key: string]: any
    }
  };
  /**
   * Output only. Create time.
   */
  readonly createTime?: Date;
  /**
   * Output only. Description of an Endpoint.
   */
  readonly description?: string;
  /**
   * Output only. Display name for the Endpoint.
   */
  readonly displayName?: string;
  /**
   * Output only. A stable, globally unique identifier for Endpoint.
   */
  readonly endpointId?: string;
  /**
   * Required. The connection details for the Endpoint.
   */
  interfaces?: Interface[];
  /**
   * Identifier. The resource name of the Endpoint. Format:
   * `projects/{project}/locations/{location}/endpoints/{endpoint}`.
   */
  name?: string;
  /**
   * Output only. Update time.
   */
  readonly updateTime?: Date;
}

/**
 * The spec of the endpoint.
 */
export interface EndpointSpec {
  /**
   * Optional. The content of the endpoint spec. Reserved for future use.
   */
  content?: {
    [key: string]: any
  };
  /**
   * Required. The type of the endpoint spec content.
   */
  type?:  | "TYPE_UNSPECIFIED" | "NO_SPEC";
}

/**
 * Message for response to fetching available Bindings.
 */
export interface FetchAvailableBindingsResponse {
  /**
   * The list of Bindings.
   */
  bindings?: Binding[];
  /**
   * A token identifying a page of results the server should return.
   */
  nextPageToken?: string;
}

/**
 * Represents the connection details for an Agent or MCP Server.
 */
export interface Interface {
  /**
   * Required. The protocol binding of the interface.
   */
  protocolBinding?:  | "PROTOCOL_BINDING_UNSPECIFIED" | "JSONRPC" | "GRPC" | "HTTP_JSON";
  /**
   * Required. The destination URL.
   */
  url?: string;
}

/**
 * Message for response to listing Agents
 */
export interface ListAgentsResponse {
  /**
   * The list of Agents.
   */
  agents?: Agent[];
  /**
   * A token identifying a page of results the server should return.
   */
  nextPageToken?: string;
}

/**
 * Message for response to listing Bindings
 */
export interface ListBindingsResponse {
  /**
   * The list of Binding resources matching the parent and filter criteria in
   * the request. Each Binding resource follows the format:
   * `projects/{project}/locations/{location}/bindings/{binding}`.
   */
  bindings?: Binding[];
  /**
   * A token identifying a page of results the server should return. Used in
   * page_token.
   */
  nextPageToken?: string;
}

/**
 * Message for response to listing Endpoints
 */
export interface ListEndpointsResponse {
  /**
   * The list of Endpoint resources matching the parent and filter criteria in
   * the request. Each Endpoint resource follows the format:
   * `projects/{project}/locations/{location}/endpoints/{endpoint}`.
   */
  endpoints?: Endpoint[];
  /**
   * A token identifying a page of results the server should return. Used in
   * page_token.
   */
  nextPageToken?: string;
}

/**
 * The response message for Locations.ListLocations.
 */
export interface ListLocationsResponse {
  /**
   * A list of locations that matches the specified filter in the request.
   */
  locations?: Location[];
  /**
   * The standard List next-page token.
   */
  nextPageToken?: string;
}

/**
 * Message for response to listing McpServers
 */
export interface ListMcpServersResponse {
  /**
   * The list of McpServers.
   */
  mcpServers?: McpServer[];
  /**
   * A token identifying a page of results the server should return.
   */
  nextPageToken?: string;
}

/**
 * The response message for Operations.ListOperations.
 */
export interface ListOperationsResponse {
  /**
   * The standard List next-page token.
   */
  nextPageToken?: string;
  /**
   * A list of operations that matches the specified filter in the request.
   */
  operations?: Operation[];
  /**
   * Unordered list. Unreachable resources. Populated when the request sets
   * `ListOperationsRequest.return_partial_success` and reads across
   * collections. For example, when attempting to list all resources across all
   * supported locations.
   */
  unreachable?: string[];
}

/**
 * Message for response to listing Services
 */
export interface ListServicesResponse {
  /**
   * A token identifying a page of results the server should return. Used in
   * page_token.
   */
  nextPageToken?: string;
  /**
   * The list of Service resources matching the parent and filter criteria in
   * the request. Each Service resource follows the format:
   * `projects/{project}/locations/{location}/services/{service}`.
   */
  services?: Service[];
}

/**
 * A resource that represents a Google Cloud location.
 */
export interface Location {
  /**
   * The friendly name for this location, typically a nearby city name. For
   * example, "Tokyo".
   */
  displayName?: string;
  /**
   * Cross-service attributes for the location. For example
   * {"cloud.googleapis.com/region": "us-east1"}
   */
  labels?: {
    [key: string]: string
  };
  /**
   * The canonical id for this location. For example: `"us-east1"`.
   */
  locationId?: string;
  /**
   * Service-specific metadata. For example the available capacity at the given
   * location.
   */
  metadata?: {
    [key: string]: any
  };
  /**
   * Resource name for the location, which may vary between implementations.
   * For example: `"projects/example-project/locations/us-east1"`
   */
  name?: string;
}

/**
 * Represents an MCP (Model Context Protocol) Server.
 */
export interface McpServer {
  /**
   * Output only. Attributes of the MCP Server. Valid values: *
   * `agentregistry.googleapis.com/system/RuntimeIdentity`: {"principal":
   * "principal://..."} - the runtime identity associated with the MCP Server. *
   * `agentregistry.googleapis.com/system/RuntimeReference`: {"uri": "//..."} -
   * the URI of the underlying resource hosting the MCP Server, for example, the
   * GKE Deployment.
   */
  readonly attributes?: {
    [key: string]: {
      [key: string]: any
    }
  };
  /**
   * Output only. Create time.
   */
  readonly createTime?: Date;
  /**
   * Output only. The description of the MCP Server.
   */
  readonly description?: string;
  /**
   * Output only. The display name of the MCP Server.
   */
  readonly displayName?: string;
  /**
   * Output only. The connection details for the MCP Server.
   */
  readonly interfaces?: Interface[];
  /**
   * Output only. A stable, globally unique identifier for MCP Servers.
   */
  readonly mcpServerId?: string;
  /**
   * Identifier. The resource name of the MCP Server. Format:
   * `projects/{project}/locations/{location}/mcpServers/{mcp_server}`.
   */
  name?: string;
  /**
   * Output only. Tools provided by the MCP Server.
   */
  readonly tools?: Tool[];
  /**
   * Output only. Update time.
   */
  readonly updateTime?: Date;
}

/**
 * The spec of the MCP Server.
 */
export interface McpServerSpec {
  /**
   * Optional. The content of the MCP Server spec. This payload is validated
   * against the schema for the specified type. The content size is limited to
   * `10KB`.
   */
  content?: {
    [key: string]: any
  };
  /**
   * Required. The type of the MCP Server spec content.
   */
  type?:  | "TYPE_UNSPECIFIED" | "NO_SPEC" | "TOOL_SPEC";
}

/**
 * This resource represents a long-running operation that is the result of a
 * network API call.
 */
export interface Operation {
  /**
   * If the value is `false`, it means the operation is still in progress. If
   * `true`, the operation is completed, and either `error` or `response` is
   * available.
   */
  done?: boolean;
  /**
   * The error result of the operation in case of failure or cancellation.
   */
  error?: Status;
  /**
   * Service-specific metadata associated with the operation. It typically
   * contains progress information and common metadata such as create time. Some
   * services might not provide such metadata. Any method that returns a
   * long-running operation should document the metadata type, if any.
   */
  metadata?: {
    [key: string]: any
  };
  /**
   * The server-assigned name, which is only unique within the same service
   * that originally returns it. If you use the default HTTP mapping, the `name`
   * should be a resource name ending with `operations/{unique_id}`.
   */
  name?: string;
  /**
   * The normal, successful response of the operation. If the original method
   * returns no data on success, such as `Delete`, the response is
   * `google.protobuf.Empty`. If the original method is standard
   * `Get`/`Create`/`Update`, the response should be the resource. For other
   * methods, the response should have the type `XxxResponse`, where `Xxx` is
   * the original method name. For example, if the original method name is
   * `TakeSnapshot()`, the inferred response type is `TakeSnapshotResponse`.
   */
  response?: {
    [key: string]: any
  };
}

/**
 * Represents the metadata of the long-running operation.
 */
export interface OperationMetadata {
  /**
   * Output only. API version used to start the operation.
   */
  readonly apiVersion?: string;
  /**
   * Output only. The time the operation was created.
   */
  readonly createTime?: Date;
  /**
   * Output only. The time the operation finished running.
   */
  readonly endTime?: Date;
  /**
   * Output only. Identifies whether the user has requested cancellation of the
   * operation. Operations that have been cancelled successfully have
   * google.longrunning.Operation.error value with a google.rpc.Status.code of
   * `1`, corresponding to `Code.CANCELLED`.
   */
  readonly requestedCancellation?: boolean;
  /**
   * Output only. Human-readable status of the operation, if any.
   */
  readonly statusMessage?: string;
  /**
   * Output only. Server-defined resource path for the target of the operation.
   */
  readonly target?: string;
  /**
   * Output only. Name of the verb executed by the operation.
   */
  readonly verb?: string;
}

/**
 * Additional options for AgentRegistry#projectsLocationsAgentsList.
 */
export interface ProjectsLocationsAgentsListOptions {
  /**
   * Optional. Filtering results
   */
  filter?: string;
  /**
   * Optional. Hint for how to order the results
   */
  orderBy?: string;
  /**
   * Optional. Requested page size. Server may return fewer items than
   * requested. If unspecified, server will pick an appropriate default.
   */
  pageSize?: number;
  /**
   * Optional. A token identifying a page of results the server should return.
   */
  pageToken?: string;
}

/**
 * Additional options for AgentRegistry#projectsLocationsBindingsCreate.
 */
export interface ProjectsLocationsBindingsCreateOptions {
  /**
   * Required. The ID to use for the binding, which will become the final
   * component of the binding's resource name. This value should be 4-63
   * characters, and must conform to RFC-1034. Specifically, it must match the
   * regular expression `^[a-z]([a-z0-9-]{0,61}[a-z0-9])?$`.
   */
  bindingId?: string;
  /**
   * Optional. An optional request ID to identify requests. Specify a unique
   * request ID so that if you must retry your request, the server will know to
   * ignore the request if it has already been completed. The server will
   * guarantee that for at least 60 minutes since the first request. For
   * example, consider a situation where you make an initial request and the
   * request times out. If you make the request again with the same request ID,
   * the server can check if original operation with the same request ID was
   * received, and if so, will ignore the second request. This prevents clients
   * from accidentally creating duplicate commitments. The request ID must be a
   * valid UUID with the exception that zero UUID is not supported
   * (00000000-0000-0000-0000-000000000000).
   */
  requestId?: string;
}

/**
 * Additional options for AgentRegistry#projectsLocationsBindingsDelete.
 */
export interface ProjectsLocationsBindingsDeleteOptions {
  /**
   * Optional. An optional request ID to identify requests. Specify a unique
   * request ID so that if you must retry your request, the server will know to
   * ignore the request if it has already been completed. The server will
   * guarantee that for at least 60 minutes after the first request. For
   * example, consider a situation where you make an initial request and the
   * request times out. If you make the request again with the same request ID,
   * the server can check if original operation with the same request ID was
   * received, and if so, will ignore the second request. This prevents clients
   * from accidentally creating duplicate commitments. The request ID must be a
   * valid UUID with the exception that zero UUID is not supported
   * (00000000-0000-0000-0000-000000000000).
   */
  requestId?: string;
}

/**
 * Additional options for
 * AgentRegistry#projectsLocationsBindingsFetchAvailable.
 */
export interface ProjectsLocationsBindingsFetchAvailableOptions {
  /**
   * Optional. Requested page size. Server may return fewer items than
   * requested. Page size is 500 if unspecified and is capped at `500` even if a
   * larger value is given.
   */
  pageSize?: number;
  /**
   * Optional. A token identifying a page of results the server should return.
   */
  pageToken?: string;
  /**
   * The identifier of the source Agent. Format: *
   * `urn:agent:{publisher}:{namespace}:{name}`
   */
  sourceIdentifier?: string;
  /**
   * Optional. The identifier of the target Agent, MCP Server, or Endpoint.
   * Format: * `urn:agent:{publisher}:{namespace}:{name}` *
   * `urn:mcp:{publisher}:{namespace}:{name}` *
   * `urn:endpoint:{publisher}:{namespace}:{name}`
   */
  targetIdentifier?: string;
}

/**
 * Additional options for AgentRegistry#projectsLocationsBindingsList.
 */
export interface ProjectsLocationsBindingsListOptions {
  /**
   * Optional. A query string used to filter the list of bindings returned. The
   * filter expression must follow AIP-160 syntax.
   */
  filter?: string;
  /**
   * Optional. Hint for how to order the results
   */
  orderBy?: string;
  /**
   * Optional. Requested page size. Server may return fewer items than
   * requested. Page size is 500 if unspecified and is capped at `500` even if a
   * larger value is given.
   */
  pageSize?: number;
  /**
   * Optional. A token identifying a page of results the server should return.
   */
  pageToken?: string;
}

/**
 * Additional options for AgentRegistry#projectsLocationsBindingsPatch.
 */
export interface ProjectsLocationsBindingsPatchOptions {
  /**
   * Optional. An optional request ID to identify requests. Specify a unique
   * request ID so that if you must retry your request, the server will know to
   * ignore the request if it has already been completed. The server will
   * guarantee that for at least 60 minutes since the first request. For
   * example, consider a situation where you make an initial request and the
   * request times out. If you make the request again with the same request ID,
   * the server can check if original operation with the same request ID was
   * received, and if so, will ignore the second request. This prevents clients
   * from accidentally creating duplicate commitments. The request ID must be a
   * valid UUID with the exception that zero UUID is not supported
   * (00000000-0000-0000-0000-000000000000).
   */
  requestId?: string;
  /**
   * Optional. Field mask is used to specify the fields to be overwritten in
   * the Binding resource by the update. The fields specified in the update_mask
   * are relative to the resource, not the full request. A field will be
   * overwritten if it is in the mask. If the user does not provide a mask then
   * all fields present in the request will be overwritten.
   */
  updateMask?: string /* FieldMask */;
}

function serializeProjectsLocationsBindingsPatchOptions(data: any): ProjectsLocationsBindingsPatchOptions {
  return {
    ...data,
    updateMask: data["updateMask"] !== undefined ? data["updateMask"] : undefined,
  };
}

function deserializeProjectsLocationsBindingsPatchOptions(data: any): ProjectsLocationsBindingsPatchOptions {
  return {
    ...data,
    updateMask: data["updateMask"] !== undefined ? data["updateMask"] : undefined,
  };
}

/**
 * Additional options for AgentRegistry#projectsLocationsEndpointsList.
 */
export interface ProjectsLocationsEndpointsListOptions {
  /**
   * Optional. A query string used to filter the list of endpoints returned.
   * The filter expression must follow AIP-160 syntax. Filtering is supported on
   * the `name`, `display_name`, `description`, `version`, and `interfaces`
   * fields. Some examples: * `name = "projects/p1/locations/l1/endpoints/e1"` *
   * `display_name = "my-endpoint"` * `description = "my-endpoint-description"`
   * * `version = "v1"` * `interfaces.transport = "HTTP_JSON"`
   */
  filter?: string;
  /**
   * Optional. Requested page size. Server may return fewer items than
   * requested. If unspecified, server will pick an appropriate default.
   */
  pageSize?: number;
  /**
   * Optional. A token identifying a page of results the server should return.
   */
  pageToken?: string;
}

/**
 * Additional options for AgentRegistry#projectsLocationsList.
 */
export interface ProjectsLocationsListOptions {
  /**
   * Optional. Do not use this field unless explicitly documented otherwise.
   * This is primarily for internal usage.
   */
  extraLocationTypes?: string;
  /**
   * A filter to narrow down results to a preferred subset. The filtering
   * language accepts strings like `"displayName=tokyo"`, and is documented in
   * more detail in [AIP-160](https://google.aip.dev/160).
   */
  filter?: string;
  /**
   * The maximum number of results to return. If not set, the service selects a
   * default.
   */
  pageSize?: number;
  /**
   * A page token received from the `next_page_token` field in the response.
   * Send that page token to receive the subsequent page.
   */
  pageToken?: string;
}

/**
 * Additional options for AgentRegistry#projectsLocationsMcpServersList.
 */
export interface ProjectsLocationsMcpServersListOptions {
  /**
   * Optional. Filtering results
   */
  filter?: string;
  /**
   * Optional. Hint for how to order the results
   */
  orderBy?: string;
  /**
   * Optional. Requested page size. Server may return fewer items than
   * requested. If unspecified, server will pick an appropriate default.
   */
  pageSize?: number;
  /**
   * Optional. A token identifying a page of results the server should return.
   */
  pageToken?: string;
}

/**
 * Additional options for AgentRegistry#projectsLocationsOperationsList.
 */
export interface ProjectsLocationsOperationsListOptions {
  /**
   * The standard list filter.
   */
  filter?: string;
  /**
   * The standard list page size.
   */
  pageSize?: number;
  /**
   * The standard list page token.
   */
  pageToken?: string;
  /**
   * When set to `true`, operations that are reachable are returned as normal,
   * and those that are unreachable are returned in the
   * ListOperationsResponse.unreachable field. This can only be `true` when
   * reading across collections. For example, when `parent` is set to
   * `"projects/example/locations/-"`. This field is not supported by default
   * and will result in an `UNIMPLEMENTED` error if set unless explicitly
   * documented otherwise in service or product specific documentation.
   */
  returnPartialSuccess?: boolean;
}

/**
 * Additional options for AgentRegistry#projectsLocationsServicesCreate.
 */
export interface ProjectsLocationsServicesCreateOptions {
  /**
   * Optional. An optional request ID to identify requests. Specify a unique
   * request ID so that if you must retry your request, the server will know to
   * ignore the request if it has already been completed. The server will
   * guarantee that for at least 60 minutes since the first request. For
   * example, consider a situation where you make an initial request and the
   * request times out. If you make the request again with the same request ID,
   * the server can check if original operation with the same request ID was
   * received, and if so, will ignore the second request. This prevents clients
   * from accidentally creating duplicate commitments. The request ID must be a
   * valid UUID with the exception that zero UUID is not supported
   * (00000000-0000-0000-0000-000000000000).
   */
  requestId?: string;
  /**
   * Required. The ID to use for the service, which will become the final
   * component of the service's resource name. This value should be 4-63
   * characters, and valid characters are `/a-z-/`.
   */
  serviceId?: string;
}

/**
 * Additional options for AgentRegistry#projectsLocationsServicesDelete.
 */
export interface ProjectsLocationsServicesDeleteOptions {
  /**
   * Optional. An optional request ID to identify requests. Specify a unique
   * request ID so that if you must retry your request, the server will know to
   * ignore the request if it has already been completed. The server will
   * guarantee that for at least 60 minutes after the first request. For
   * example, consider a situation where you make an initial request and the
   * request times out. If you make the request again with the same request ID,
   * the server can check if original operation with the same request ID was
   * received, and if so, will ignore the second request. This prevents clients
   * from accidentally creating duplicate commitments. The request ID must be a
   * valid UUID with the exception that zero UUID is not supported
   * (00000000-0000-0000-0000-000000000000).
   */
  requestId?: string;
}

/**
 * Additional options for AgentRegistry#projectsLocationsServicesList.
 */
export interface ProjectsLocationsServicesListOptions {
  /**
   * Optional. A query string used to filter the list of services returned. The
   * filter expression must follow AIP-160 syntax. Filtering is supported on the
   * `name`, `display_name`, `description`, and `labels` fields. Some examples:
   * * `name = "projects/p1/locations/l1/services/s1"` * `display_name =
   * "my-service"` * `description : "myservice description"` * `labels.env =
   * "prod"`
   */
  filter?: string;
  /**
   * Optional. Requested page size. Server may return fewer items than
   * requested. If unspecified, server will pick an appropriate default.
   */
  pageSize?: number;
  /**
   * Optional. A token identifying a page of results the server should return.
   */
  pageToken?: string;
}

/**
 * Additional options for AgentRegistry#projectsLocationsServicesPatch.
 */
export interface ProjectsLocationsServicesPatchOptions {
  /**
   * Optional. An optional request ID to identify requests. Specify a unique
   * request ID so that if you must retry your request, the server will know to
   * ignore the request if it has already been completed. The server will
   * guarantee that for at least 60 minutes since the first request. For
   * example, consider a situation where you make an initial request and the
   * request times out. If you make the request again with the same request ID,
   * the server can check if original operation with the same request ID was
   * received, and if so, will ignore the second request. This prevents clients
   * from accidentally creating duplicate commitments. The request ID must be a
   * valid UUID with the exception that zero UUID is not supported
   * (00000000-0000-0000-0000-000000000000).
   */
  requestId?: string;
  /**
   * Optional. Field mask is used to specify the fields to be overwritten in
   * the Service resource by the update. The fields specified in the update_mask
   * are relative to the resource, not the full request. A field will be
   * overwritten if it is in the mask. If the user does not provide a mask then
   * all fields present in the request will be overwritten.
   */
  updateMask?: string /* FieldMask */;
}

function serializeProjectsLocationsServicesPatchOptions(data: any): ProjectsLocationsServicesPatchOptions {
  return {
    ...data,
    updateMask: data["updateMask"] !== undefined ? data["updateMask"] : undefined,
  };
}

function deserializeProjectsLocationsServicesPatchOptions(data: any): ProjectsLocationsServicesPatchOptions {
  return {
    ...data,
    updateMask: data["updateMask"] !== undefined ? data["updateMask"] : undefined,
  };
}

/**
 * Represents the protocol of an Agent.
 */
export interface Protocol {
  /**
   * Output only. The connection details for the Agent.
   */
  readonly interfaces?: Interface[];
  /**
   * Output only. The version of the protocol, for example, the A2A Agent Card
   * version.
   */
  readonly protocolVersion?: string;
  /**
   * Output only. The type of the protocol.
   */
  readonly type?:  | "TYPE_UNSPECIFIED" | "A2A_AGENT" | "CUSTOM";
}

/**
 * Message for searching Agents
 */
export interface SearchAgentsRequest {
  /**
   * Optional. The maximum number of search results to return per page. The
   * page size is capped at `100`, even if a larger value is specified. A
   * negative value will result in an `INVALID_ARGUMENT` error. If unspecified
   * or set to `0`, a default value of `20` will be used. The server may return
   * fewer results than requested.
   */
  pageSize?: number;
  /**
   * Optional. If present, retrieve the next batch of results from the
   * preceding call to this method. `page_token` must be the value of
   * `next_page_token` from the previous response. The values of all other
   * method parameters, must be identical to those in the previous call.
   */
  pageToken?: string;
  /**
   * Optional. Search criteria used to select the Agents to return. If no
   * search criteria is specified then all accessible Agents will be returned.
   * Search expressions can be used to restrict results based upon searchable
   * fields, where the operators can be used along with the suffix wildcard
   * symbol `*`. See
   * [instructions](https://docs.cloud.google.com/agent-registry/search-agents-and-tools)
   * for more details. Allowed operators: `=`, `:`, `NOT`, `AND`, `OR`, and
   * `()`. Searchable fields: | Field | `=` | `:` | `*` | Keyword Search |
   * |--------------------|-----|-----|-----|----------------| | agentId | Yes |
   * Yes | Yes | Included | | name | No | Yes | Yes | Included | | displayName |
   * No | Yes | Yes | Included | | description | No | Yes | No | Included | |
   * skills | No | Yes | No | Included | | skills.id | No | Yes | No | Included
   * | | skills.name | No | Yes | No | Included | | skills.description | No |
   * Yes | No | Included | | skills.tags | No | Yes | No | Included | |
   * skills.examples | No | Yes | No | Included | Examples: *
   * `agentId="urn:agent:projects-123:projects:123:locations:us-central1:reasoningEngines:1234"`
   * to find the agent with the specified agent ID. * `name:important` to find
   * agents whose name contains `important` as a word. * `displayName:works*` to
   * find agents whose display name contains words that start with `works`. *
   * `skills.tags:test` to find agents whose skills tags contain `test`. *
   * `planner OR booking` to find agents whose metadata contains the words
   * `planner` or `booking`.
   */
  searchString?: string;
}

/**
 * Message for response to searching Agents
 */
export interface SearchAgentsResponse {
  /**
   * A list of Agents that match the `search_string`.
   */
  agents?: Agent[];
  /**
   * If there are more results than those appearing in this response, then
   * `next_page_token` is included. To get the next set of results, call this
   * method again using the value of `next_page_token` as `page_token`.
   */
  nextPageToken?: string;
}

/**
 * Message for searching MCP Servers
 */
export interface SearchMcpServersRequest {
  /**
   * Optional. The maximum number of search results to return per page. The
   * page size is capped at `100`, even if a larger value is specified. A
   * negative value will result in an `INVALID_ARGUMENT` error. If unspecified
   * or set to `0`, a default value of `20` will be used. The server may return
   * fewer results than requested.
   */
  pageSize?: number;
  /**
   * Optional. If present, retrieve the next batch of results from the
   * preceding call to this method. `page_token` must be the value of
   * `next_page_token` from the previous response. The values of all other
   * method parameters, must be identical to those in the previous call.
   */
  pageToken?: string;
  /**
   * Optional. Search criteria used to select the MCP Servers to return. If no
   * search criteria is specified then all accessible MCP Servers will be
   * returned. Search expressions can be used to restrict results based upon
   * searchable fields, where the operators can be used along with the suffix
   * wildcard symbol `*`. See
   * [instructions](https://docs.cloud.google.com/agent-registry/search-agents-and-tools)
   * for more details. Allowed operators: `=`, `:`, `NOT`, `AND`, `OR`, and
   * `()`. Searchable fields: | Field | `=` | `:` | `*` | Keyword Search |
   * |--------------------|-----|-----|-----|----------------| | mcpServerId |
   * Yes | Yes | Yes | Included | | name | No | Yes | Yes | Included | |
   * displayName | No | Yes | Yes | Included | Examples: *
   * `mcpServerId="urn:mcp:projects-123:projects:123:locations:us-central1:agentregistry:services:service-id"`
   * to find the MCP Server with the specified MCP Server ID. * `name:important`
   * to find MCP Servers whose name contains `important` as a word. *
   * `displayName:works*` to find MCP Servers whose display name contains words
   * that start with `works`. * `planner OR booking` to find MCP Servers whose
   * metadata contains the words `planner` or `booking`. *
   * `mcpServerId:service-id AND (displayName:planner OR displayName:booking)`
   * to find MCP Servers whose MCP Server ID contains `service-id` and whose
   * display name contains `planner` or `booking`.
   */
  searchString?: string;
}

/**
 * Message for response to searching MCP Servers
 */
export interface SearchMcpServersResponse {
  /**
   * A list of McpServers that match the `search_string`.
   */
  mcpServers?: McpServer[];
  /**
   * If there are more results than those appearing in this response, then
   * `next_page_token` is included. To get the next set of results, call this
   * method again using the value of `next_page_token` as `page_token`.
   */
  nextPageToken?: string;
}

/**
 * Represents a user-defined Service.
 */
export interface Service {
  /**
   * Optional. The spec of the Agent. When `agent_spec` is set, the type of the
   * service is Agent.
   */
  agentSpec?: AgentSpec;
  /**
   * Output only. Create time.
   */
  readonly createTime?: Date;
  /**
   * Optional. User-defined description of an Service. Can have a maximum
   * length of `2048` characters.
   */
  description?: string;
  /**
   * Optional. User-defined display name for the Service. Can have a maximum
   * length of `63` characters.
   */
  displayName?: string;
  /**
   * Optional. The spec of the Endpoint. When `endpoint_spec` is set, the type
   * of the service is Endpoint.
   */
  endpointSpec?: EndpointSpec;
  /**
   * Optional. The connection details for the Service.
   */
  interfaces?: Interface[];
  /**
   * Optional. The spec of the MCP Server. When `mcp_server_spec` is set, the
   * type of the service is MCP Server.
   */
  mcpServerSpec?: McpServerSpec;
  /**
   * Identifier. The resource name of the Service. Format:
   * `projects/{project}/locations/{location}/services/{service}`.
   */
  name?: string;
  /**
   * Output only. The resource name of the resulting Agent, MCP Server, or
   * Endpoint. Format: *
   * `projects/{project}/locations/{location}/mcpServers/{mcp_server}` *
   * `projects/{project}/locations/{location}/agents/{agent}` *
   * `projects/{project}/locations/{location}/endpoints/{endpoint}`
   */
  readonly registryResource?: string;
  /**
   * Output only. Update time.
   */
  readonly updateTime?: Date;
}

/**
 * The source of the Binding.
 */
export interface Source {
  /**
   * The identifier of the source Agent. Format: *
   * `urn:agent:{publisher}:{namespace}:{name}`
   */
  identifier?: string;
}

/**
 * The `Status` type defines a logical error model that is suitable for
 * different programming environments, including REST APIs and RPC APIs. It is
 * used by [gRPC](https://github.com/grpc). Each `Status` message contains three
 * pieces of data: error code, error message, and error details. You can find
 * out more about this error model and how to work with it in the [API Design
 * Guide](https://cloud.google.com/apis/design/errors).
 */
export interface Status {
  /**
   * The status code, which should be an enum value of google.rpc.Code.
   */
  code?: number;
  /**
   * A list of messages that carry the error details. There is a common set of
   * message types for APIs to use.
   */
  details?: {
    [key: string]: any
  }[];
  /**
   * A developer-facing error message, which should be in English. Any
   * user-facing error message should be localized and sent in the
   * google.rpc.Status.details field, or localized by the client.
   */
  message?: string;
}

/**
 * The target of the Binding.
 */
export interface Target {
  /**
   * The identifier of the target Agent, MCP Server, or Endpoint. Format: *
   * `urn:agent:{publisher}:{namespace}:{name}` *
   * `urn:mcp:{publisher}:{namespace}:{name}` *
   * `urn:endpoint:{publisher}:{namespace}:{name}`
   */
  identifier?: string;
}

/**
 * Represents a single tool provided by an MCP Server.
 */
export interface Tool {
  /**
   * Output only. Annotations associated with the tool.
   */
  readonly annotations?: Annotations;
  /**
   * Output only. Description of what the tool does.
   */
  readonly description?: string;
  /**
   * Output only. Human-readable name of the tool.
   */
  readonly name?: string;
}