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

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 TranscriptionStreamTextDelta = {
  type: "transcription.text.delta";
  text: string;
  [additionalProperties: string]: unknown;
};

/** @internal */
export const TranscriptionStreamTextDelta$inboundSchema: z.ZodType<
  TranscriptionStreamTextDelta,
  unknown
> = z.object({
  type: z.literal("transcription.text.delta"),
  text: z.string(),
}).catchall(z.any());
/** @internal */
export type TranscriptionStreamTextDelta$Outbound = {
  type: "transcription.text.delta";
  text: string;
  [additionalProperties: string]: unknown;
};

/** @internal */
export const TranscriptionStreamTextDelta$outboundSchema: z.ZodType<
  TranscriptionStreamTextDelta$Outbound,
  TranscriptionStreamTextDelta
> = z.object({
  type: z.literal("transcription.text.delta"),
  text: z.string(),
}).catchall(z.any());

export function transcriptionStreamTextDeltaToJSON(
  transcriptionStreamTextDelta: TranscriptionStreamTextDelta,
): string {
  return JSON.stringify(
    TranscriptionStreamTextDelta$outboundSchema.parse(
      transcriptionStreamTextDelta,
    ),
  );
}
export function transcriptionStreamTextDeltaFromJSON(
  jsonString: string,
): SafeParseResult<TranscriptionStreamTextDelta, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => TranscriptionStreamTextDelta$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'TranscriptionStreamTextDelta' from JSON`,
  );
}
