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

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

export type CreateConnectorRequest = {
  protocol?: "mcp" | undefined;
  /**
   * The name of the connector. Should be 64 char length maximum, alphanumeric, only underscores/dashes.
   */
  name: string;
  /**
   * Optional human-readable title for the connector.
   */
  title?: string | null | undefined;
  /**
   * The description of the connector.
   */
  description: string;
  /**
   * The optional url of the icon you want to associate to the connector.
   */
  iconUrl?: string | null | undefined;
  visibility?: ResourceVisibility | undefined;
  /**
   * The url of the MCP server.
   */
  server: string;
  /**
   * Optional organization-level headers to be sent with the request to the mcp server.
   */
  headers?: { [k: string]: any } | null | undefined;
  /**
   * Optional additional authentication data for the connector.
   */
  authData?: AuthData | null | undefined;
  /**
   * Optional system prompt for the connector.
   */
  systemPrompt?: string | null | undefined;
};

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

/** @internal */
export const CreateConnectorRequest$outboundSchema: z.ZodType<
  CreateConnectorRequest$Outbound,
  CreateConnectorRequest
> = z.object({
  protocol: z.literal("mcp").default("mcp" as const),
  name: z.string(),
  title: z.nullable(z.string()).optional(),
  description: z.string(),
  iconUrl: z.nullable(z.string()).optional(),
  visibility: ResourceVisibility$outboundSchema.optional(),
  server: z.string(),
  headers: z.nullable(z.record(z.string(), z.any())).optional(),
  authData: z.nullable(AuthData$outboundSchema).optional(),
  systemPrompt: z.nullable(z.string()).optional(),
}).transform((v) => {
  return remap$(v, {
    iconUrl: "icon_url",
    authData: "auth_data",
    systemPrompt: "system_prompt",
  });
});

export function createConnectorRequestToJSON(
  createConnectorRequest: CreateConnectorRequest,
): string {
  return JSON.stringify(
    CreateConnectorRequest$outboundSchema.parse(createConnectorRequest),
  );
}
