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

import * as z from "zod/v3";
import { remap as remap$ } from "../lib/primitives.js";

export type CreatePrivateLinkEndpointRequestBody = {
  /**
   * The project ID to create the PrivateLink endpoint for.
   */
  projectId: string;
  /**
   * The name of the PrivateLink endpoint, used as its label in the Vercel dashboard.
   */
  name: string;
  /**
   * The Vercel region to provision the endpoint in. Advanced Networking must be enabled for the project in that region. The endpoint service itself may live in another AWS region.
   */
  vercelRegion: string;
  /**
   * The name of the AWS VPC endpoint service to connect to. Its AWS region is read from the name; when that region differs from the one behind `vercelRegion`, the service must allow cross-region access.
   */
  awsServiceName: string;
  /**
   * Whether to resolve the endpoint service through its private DNS names, which are then returned in `privateDnsNames`. Defaults to `false`, in which case the endpoint is reachable through the DNS names in `awsDnsEntries`.
   */
  enablePrivateDns?: boolean | undefined;
};

export type CreatePrivateLinkEndpointRequest = {
  /**
   * The Team identifier to perform the request on behalf of.
   */
  teamId?: string | undefined;
  /**
   * The Team slug to perform the request on behalf of.
   */
  slug?: string | undefined;
  requestBody?: CreatePrivateLinkEndpointRequestBody | undefined;
};

/** @internal */
export type CreatePrivateLinkEndpointRequestBody$Outbound = {
  projectId: string;
  name: string;
  vercelRegion: string;
  awsServiceName: string;
  enablePrivateDns?: boolean | undefined;
};

/** @internal */
export const CreatePrivateLinkEndpointRequestBody$outboundSchema: z.ZodType<
  CreatePrivateLinkEndpointRequestBody$Outbound,
  z.ZodTypeDef,
  CreatePrivateLinkEndpointRequestBody
> = z.object({
  projectId: z.string(),
  name: z.string(),
  vercelRegion: z.string(),
  awsServiceName: z.string(),
  enablePrivateDns: z.boolean().optional(),
});

export function createPrivateLinkEndpointRequestBodyToJSON(
  createPrivateLinkEndpointRequestBody: CreatePrivateLinkEndpointRequestBody,
): string {
  return JSON.stringify(
    CreatePrivateLinkEndpointRequestBody$outboundSchema.parse(
      createPrivateLinkEndpointRequestBody,
    ),
  );
}

/** @internal */
export type CreatePrivateLinkEndpointRequest$Outbound = {
  teamId?: string | undefined;
  slug?: string | undefined;
  RequestBody?: CreatePrivateLinkEndpointRequestBody$Outbound | undefined;
};

/** @internal */
export const CreatePrivateLinkEndpointRequest$outboundSchema: z.ZodType<
  CreatePrivateLinkEndpointRequest$Outbound,
  z.ZodTypeDef,
  CreatePrivateLinkEndpointRequest
> = z.object({
  teamId: z.string().optional(),
  slug: z.string().optional(),
  requestBody: z.lazy(() => CreatePrivateLinkEndpointRequestBody$outboundSchema)
    .optional(),
}).transform((v) => {
  return remap$(v, {
    requestBody: "RequestBody",
  });
});

export function createPrivateLinkEndpointRequestToJSON(
  createPrivateLinkEndpointRequest: CreatePrivateLinkEndpointRequest,
): string {
  return JSON.stringify(
    CreatePrivateLinkEndpointRequest$outboundSchema.parse(
      createPrivateLinkEndpointRequest,
    ),
  );
}
