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

import * as z from "zod/v4";
import { remap as remap$ } from "../../lib/primitives.js";
import { ClosedEnum } from "../../types/enums.js";
import {
  CreateVespaSearchIndexInfoRequest,
  CreateVespaSearchIndexInfoRequest$Outbound,
  CreateVespaSearchIndexInfoRequest$outboundSchema,
} from "./createvespasearchindexinforequest.js";

export const CreateSearchIndexInfoRequestStatus = {
  Online: "online",
  Offline: "offline",
} as const;
export type CreateSearchIndexInfoRequestStatus = ClosedEnum<
  typeof CreateSearchIndexInfoRequestStatus
>;

export type CreateSearchIndexInfoRequestIndex =
  CreateVespaSearchIndexInfoRequest;

export type CreateSearchIndexInfoRequest = {
  name: string;
  documentCount?: number | null | undefined;
  status?: CreateSearchIndexInfoRequestStatus | undefined;
  index: CreateVespaSearchIndexInfoRequest;
};

/** @internal */
export const CreateSearchIndexInfoRequestStatus$outboundSchema: z.ZodEnum<
  typeof CreateSearchIndexInfoRequestStatus
> = z.enum(CreateSearchIndexInfoRequestStatus);

/** @internal */
export type CreateSearchIndexInfoRequestIndex$Outbound =
  CreateVespaSearchIndexInfoRequest$Outbound;

/** @internal */
export const CreateSearchIndexInfoRequestIndex$outboundSchema: z.ZodType<
  CreateSearchIndexInfoRequestIndex$Outbound,
  CreateSearchIndexInfoRequestIndex
> = CreateVespaSearchIndexInfoRequest$outboundSchema;

export function createSearchIndexInfoRequestIndexToJSON(
  createSearchIndexInfoRequestIndex: CreateSearchIndexInfoRequestIndex,
): string {
  return JSON.stringify(
    CreateSearchIndexInfoRequestIndex$outboundSchema.parse(
      createSearchIndexInfoRequestIndex,
    ),
  );
}

/** @internal */
export type CreateSearchIndexInfoRequest$Outbound = {
  name: string;
  document_count?: number | null | undefined;
  status: string;
  index: CreateVespaSearchIndexInfoRequest$Outbound;
};

/** @internal */
export const CreateSearchIndexInfoRequest$outboundSchema: z.ZodType<
  CreateSearchIndexInfoRequest$Outbound,
  CreateSearchIndexInfoRequest
> = z.object({
  name: z.string(),
  documentCount: z.nullable(z.int()).optional(),
  status: CreateSearchIndexInfoRequestStatus$outboundSchema.default("offline"),
  index: CreateVespaSearchIndexInfoRequest$outboundSchema,
}).transform((v) => {
  return remap$(v, {
    documentCount: "document_count",
  });
});

export function createSearchIndexInfoRequestToJSON(
  createSearchIndexInfoRequest: CreateSearchIndexInfoRequest,
): string {
  return JSON.stringify(
    CreateSearchIndexInfoRequest$outboundSchema.parse(
      createSearchIndexInfoRequest,
    ),
  );
}
