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

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";
import {
  UsageInfoDollarDefs,
  UsageInfoDollarDefs$inboundSchema,
} from "./usageinfodollardefs.js";

export type SpeechStreamDone = {
  type: "speech.audio.done";
  usage: UsageInfoDollarDefs;
};

/** @internal */
export const SpeechStreamDone$inboundSchema: z.ZodType<
  SpeechStreamDone,
  unknown
> = z.object({
  type: z.literal("speech.audio.done"),
  usage: UsageInfoDollarDefs$inboundSchema,
});

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