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

import * as z from "zod/v4";
import { safeParse } from "../../lib/schemas.js";
import { Result as SafeParseResult } from "../../types/fp.js";
import { SDKValidationError } from "../errors/sdkvalidationerror.js";

export type RealtimeTranscriptionInputAudioAppend = {
  type?: "input_audio.append" | undefined;
  /**
   * Base64-encoded raw PCM bytes matching the current audio_format. Max decoded size: 262144 bytes.
   */
  audio: string;
};

/** @internal */
export const RealtimeTranscriptionInputAudioAppend$inboundSchema: z.ZodType<
  RealtimeTranscriptionInputAudioAppend,
  unknown
> = z.object({
  type: z.literal("input_audio.append").default("input_audio.append"),
  audio: z.string(),
});
/** @internal */
export type RealtimeTranscriptionInputAudioAppend$Outbound = {
  type: "input_audio.append";
  audio: string;
};

/** @internal */
export const RealtimeTranscriptionInputAudioAppend$outboundSchema: z.ZodType<
  RealtimeTranscriptionInputAudioAppend$Outbound,
  RealtimeTranscriptionInputAudioAppend
> = z.object({
  type: z.literal("input_audio.append").default("input_audio.append" as const),
  audio: z.string(),
});

export function realtimeTranscriptionInputAudioAppendToJSON(
  realtimeTranscriptionInputAudioAppend: RealtimeTranscriptionInputAudioAppend,
): string {
  return JSON.stringify(
    RealtimeTranscriptionInputAudioAppend$outboundSchema.parse(
      realtimeTranscriptionInputAudioAppend,
    ),
  );
}
export function realtimeTranscriptionInputAudioAppendFromJSON(
  jsonString: string,
): SafeParseResult<RealtimeTranscriptionInputAudioAppend, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) =>
      RealtimeTranscriptionInputAudioAppend$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'RealtimeTranscriptionInputAudioAppend' from JSON`,
  );
}
