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

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 { VoiceResponse, VoiceResponse$inboundSchema } from "./voiceresponse.js";

/**
 * Schema for voice list response
 */
export type VoiceListResponse = {
  items: Array<VoiceResponse>;
  total: number;
  page: number;
  pageSize: number;
  totalPages: number;
};

/** @internal */
export const VoiceListResponse$inboundSchema: z.ZodType<
  VoiceListResponse,
  unknown
> = z.object({
  items: z.array(VoiceResponse$inboundSchema),
  total: z.int(),
  page: z.int(),
  page_size: z.int(),
  total_pages: z.int(),
}).transform((v) => {
  return remap$(v, {
    "page_size": "pageSize",
    "total_pages": "totalPages",
  });
});

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