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

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 SpeechStreamAudioDelta = {
  type: "speech.audio.delta";
  audioData: string;
};

/** @internal */
export const SpeechStreamAudioDelta$inboundSchema: z.ZodType<
  SpeechStreamAudioDelta,
  unknown
> = z.object({
  type: z.literal("speech.audio.delta"),
  audio_data: z.string(),
}).transform((v) => {
  return remap$(v, {
    "audio_data": "audioData",
  });
});

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