/*
 * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
 * @generated-id: acb3cd06c21b
 */

import * as z from "zod/v4";
import { remap as remap$ } from "../../lib/primitives.js";
import {
  AuthData,
  AuthData$Outbound,
  AuthData$outboundSchema,
} from "./authdata.js";
import {
  ConnectorProtocol,
  ConnectorProtocol$outboundSchema,
} from "./connectorprotocol.js";

export type UpdateConnectorRequest = {
  /**
   * Optional human-readable title for the connector.
   */
  title?: string | null | undefined;
  /**
   * The name of the connector.
   */
  name?: string | null | undefined;
  /**
   * The description of the connector.
   */
  description?: string | null | undefined;
  /**
   * The optional url of the icon you want to associate to the connector.
   */
  iconUrl?: string | null | undefined;
  /**
   * Optional system prompt for the connector.
   */
  systemPrompt?: string | null | undefined;
  /**
   * Protocol of the connector.
   */
  protocol?: ConnectorProtocol | null | undefined;
  /**
   * Optional new connection config.
   */
  connectionConfig?: { [k: string]: any } | null | undefined;
  /**
   * Optional new connection secrets
   */
  connectionSecrets?: { [k: string]: any } | null | undefined;
  /**
   * New server url for your mcp connector.
   */
  server?: string | null | undefined;
  /**
   * New headers for your mcp connector.
   */
  headers?: { [k: string]: any } | null | undefined;
  /**
   * New authentication data for your mcp connector.
   */
  authData?: AuthData | null | undefined;
};

/** @internal */
export type UpdateConnectorRequest$Outbound = {
  title?: string | null | undefined;
  name?: string | null | undefined;
  description?: string | null | undefined;
  icon_url?: string | null | undefined;
  system_prompt?: string | null | undefined;
  protocol?: string | null | undefined;
  connection_config?: { [k: string]: any } | null | undefined;
  connection_secrets?: { [k: string]: any } | null | undefined;
  server?: string | null | undefined;
  headers?: { [k: string]: any } | null | undefined;
  auth_data?: AuthData$Outbound | null | undefined;
};

/** @internal */
export const UpdateConnectorRequest$outboundSchema: z.ZodType<
  UpdateConnectorRequest$Outbound,
  UpdateConnectorRequest
> = z.object({
  title: z.nullable(z.string()).optional(),
  name: z.nullable(z.string()).optional(),
  description: z.nullable(z.string()).optional(),
  iconUrl: z.nullable(z.string()).optional(),
  systemPrompt: z.nullable(z.string()).optional(),
  protocol: z.nullable(ConnectorProtocol$outboundSchema).optional(),
  connectionConfig: z.nullable(z.record(z.string(), z.any())).optional(),
  connectionSecrets: z.nullable(z.record(z.string(), z.any())).optional(),
  server: z.nullable(z.string()).optional(),
  headers: z.nullable(z.record(z.string(), z.any())).optional(),
  authData: z.nullable(AuthData$outboundSchema).optional(),
}).transform((v) => {
  return remap$(v, {
    iconUrl: "icon_url",
    systemPrompt: "system_prompt",
    connectionConfig: "connection_config",
    connectionSecrets: "connection_secrets",
    authData: "auth_data",
  });
});

export function updateConnectorRequestToJSON(
  updateConnectorRequest: UpdateConnectorRequest,
): string {
  return JSON.stringify(
    UpdateConnectorRequest$outboundSchema.parse(updateConnectorRequest),
  );
}
