/*
 * 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 CreateNetworkRequestBody = {
  awsAvailabilityZoneIds?: Array<string> | undefined;
  /**
   * The CIDR block of the network
   */
  cidr: string;
  /**
   * The name of the network
   */
  name: string;
  /**
   * The region where the network will be created
   */
  region: string;
};

export type CreateNetworkRequest = {
  /**
   * 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?: CreateNetworkRequestBody | undefined;
};

/** @internal */
export type CreateNetworkRequestBody$Outbound = {
  awsAvailabilityZoneIds?: Array<string> | undefined;
  cidr: string;
  name: string;
  region: string;
};

/** @internal */
export const CreateNetworkRequestBody$outboundSchema: z.ZodType<
  CreateNetworkRequestBody$Outbound,
  z.ZodTypeDef,
  CreateNetworkRequestBody
> = z.object({
  awsAvailabilityZoneIds: z.array(z.string()).optional(),
  cidr: z.string(),
  name: z.string(),
  region: z.string(),
});

export function createNetworkRequestBodyToJSON(
  createNetworkRequestBody: CreateNetworkRequestBody,
): string {
  return JSON.stringify(
    CreateNetworkRequestBody$outboundSchema.parse(createNetworkRequestBody),
  );
}

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

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

export function createNetworkRequestToJSON(
  createNetworkRequest: CreateNetworkRequest,
): string {
  return JSON.stringify(
    CreateNetworkRequest$outboundSchema.parse(createNetworkRequest),
  );
}
