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

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";

export type VespaSchemaResponse = {
  name: string;
  documentCount: number | null;
};

/** @internal */
export const VespaSchemaResponse$inboundSchema: z.ZodType<
  VespaSchemaResponse,
  unknown
> = z.object({
  name: z.string(),
  document_count: z.nullable(z.int()),
}).transform((v) => {
  return remap$(v, {
    "document_count": "documentCount",
  });
});

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