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

import * as z from "zod/v4";
import { remap as remap$ } from "../../lib/primitives.js";
import { safeParse } from "../../lib/schemas.js";
import { Result as SafeParseResult } from "../../types/fp.js";
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
import {
  VespaSchemaResponse,
  VespaSchemaResponse$inboundSchema,
} from "./vespaschemaresponse.js";

export type VespaSearchIndexInfoResponse = {
  type: "vespa";
  k8sCluster: string;
  k8sNamespace: string;
  vespaInstanceName: string;
  schemas: Array<VespaSchemaResponse>;
};

/** @internal */
export const VespaSearchIndexInfoResponse$inboundSchema: z.ZodType<
  VespaSearchIndexInfoResponse,
  unknown
> = z.object({
  type: z.literal("vespa"),
  k8s_cluster: z.string(),
  k8s_namespace: z.string(),
  vespa_instance_name: z.string(),
  schemas: z.array(VespaSchemaResponse$inboundSchema),
}).transform((v) => {
  return remap$(v, {
    "k8s_cluster": "k8sCluster",
    "k8s_namespace": "k8sNamespace",
    "vespa_instance_name": "vespaInstanceName",
  });
});

export function vespaSearchIndexInfoResponseFromJSON(
  jsonString: string,
): SafeParseResult<VespaSearchIndexInfoResponse, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => VespaSearchIndexInfoResponse$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'VespaSearchIndexInfoResponse' from JSON`,
  );
}
