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

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

export type RealtimeTranscriptionInputAudioEnd = {
  type?: "input_audio.end" | undefined;
};

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

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

export function realtimeTranscriptionInputAudioEndToJSON(
  realtimeTranscriptionInputAudioEnd: RealtimeTranscriptionInputAudioEnd,
): string {
  return JSON.stringify(
    RealtimeTranscriptionInputAudioEnd$outboundSchema.parse(
      realtimeTranscriptionInputAudioEnd,
    ),
  );
}
export function realtimeTranscriptionInputAudioEndFromJSON(
  jsonString: string,
): SafeParseResult<RealtimeTranscriptionInputAudioEnd, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) =>
      RealtimeTranscriptionInputAudioEnd$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'RealtimeTranscriptionInputAudioEnd' from JSON`,
  );
}
