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

import * as z from "zod/v4";
import { remap as remap$ } from "../../lib/primitives.js";
import {
  SpeechOutputFormat,
  SpeechOutputFormat$outboundSchema,
} from "./speechoutputformat.js";

export type SpeechRequest = {
  model?: string | null | undefined;
  metadata?: { [k: string]: any } | null | undefined;
  stream?: boolean | undefined;
  /**
   * The preset or custom voice to use for generating the speech.
   */
  voiceId?: string | null | undefined;
  /**
   * The audio reference for generating the speech.
   */
  refAudio?: string | null | undefined;
  /**
   * Text to generate a speech from
   */
  input: string;
  responseFormat?: SpeechOutputFormat | undefined;
  [additionalProperties: string]: unknown;
};

/** @internal */
export type SpeechRequest$Outbound = {
  model?: string | null | undefined;
  metadata?: { [k: string]: any } | null | undefined;
  stream: boolean;
  voice_id?: string | null | undefined;
  ref_audio?: string | null | undefined;
  input: string;
  response_format?: string | undefined;
  [additionalProperties: string]: unknown;
};

/** @internal */
export const SpeechRequest$outboundSchema: z.ZodType<
  SpeechRequest$Outbound,
  SpeechRequest
> = z.object({
  model: z.nullable(z.string()).optional(),
  metadata: z.nullable(z.record(z.string(), z.any())).optional(),
  stream: z.boolean().default(false),
  voiceId: z.nullable(z.string()).optional(),
  refAudio: z.nullable(z.string()).optional(),
  input: z.string(),
  responseFormat: SpeechOutputFormat$outboundSchema.optional(),
}).catchall(z.any()).transform((v) => {
  return {
    ...remap$(v, {
      voiceId: "voice_id",
      refAudio: "ref_audio",
      responseFormat: "response_format",
    }),
  };
});

export function speechRequestToJSON(speechRequest: SpeechRequest): string {
  return JSON.stringify(SpeechRequest$outboundSchema.parse(speechRequest));
}
