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

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 AudioChunk = {
  type: "input_audio";
  inputAudio: string;
};

/** @internal */
export const AudioChunk$inboundSchema: z.ZodType<AudioChunk, unknown> = z
  .object({
    type: z.literal("input_audio"),
    input_audio: z.string(),
  }).transform((v) => {
    return remap$(v, {
      "input_audio": "inputAudio",
    });
  });
/** @internal */
export type AudioChunk$Outbound = {
  type: "input_audio";
  input_audio: string;
};

/** @internal */
export const AudioChunk$outboundSchema: z.ZodType<
  AudioChunk$Outbound,
  AudioChunk
> = z.object({
  type: z.literal("input_audio"),
  inputAudio: z.string(),
}).transform((v) => {
  return remap$(v, {
    inputAudio: "input_audio",
  });
});

export function audioChunkToJSON(audioChunk: AudioChunk): string {
  return JSON.stringify(AudioChunk$outboundSchema.parse(audioChunk));
}
export function audioChunkFromJSON(
  jsonString: string,
): SafeParseResult<AudioChunk, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => AudioChunk$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'AudioChunk' from JSON`,
  );
}
