/*
 * 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 UpdatePrivateLinkEndpointRequestBody = {
  /**
   * A new name for the PrivateLink endpoint. When omitted, the current name is kept.
   */
  name?: string | undefined;
  /**
   * When `true`, resolves the endpoint service through its private DNS names, which are then returned in `privateDnsNames`. When `false`, clears them. When omitted, the current setting is kept. At least one of `name` or `enablePrivateDns` must be provided.
   */
  enablePrivateDns?: boolean | undefined;
};

export type UpdatePrivateLinkEndpointRequest = {
  /**
   * The project ID the PrivateLink endpoint belongs to.
   */
  projectId: string;
  /**
   * The unique identifier of the PrivateLink endpoint.
   */
  endpointId: string;
  /**
   * 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?: UpdatePrivateLinkEndpointRequestBody | undefined;
};

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

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

export function updatePrivateLinkEndpointRequestBodyToJSON(
  updatePrivateLinkEndpointRequestBody: UpdatePrivateLinkEndpointRequestBody,
): string {
  return JSON.stringify(
    UpdatePrivateLinkEndpointRequestBody$outboundSchema.parse(
      updatePrivateLinkEndpointRequestBody,
    ),
  );
}

/** @internal */
export type UpdatePrivateLinkEndpointRequest$Outbound = {
  projectId: string;
  endpointId: string;
  teamId?: string | undefined;
  slug?: string | undefined;
  RequestBody?: UpdatePrivateLinkEndpointRequestBody$Outbound | undefined;
};

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

export function updatePrivateLinkEndpointRequestToJSON(
  updatePrivateLinkEndpointRequest: UpdatePrivateLinkEndpointRequest,
): string {
  return JSON.stringify(
    UpdatePrivateLinkEndpointRequest$outboundSchema.parse(
      updatePrivateLinkEndpointRequest,
    ),
  );
}
