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

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 TranscriptionStreamLanguage = {
  type: "transcription.language";
  audioLanguage: string;
  [additionalProperties: string]: unknown;
};

/** @internal */
export const TranscriptionStreamLanguage$inboundSchema: z.ZodType<
  TranscriptionStreamLanguage,
  unknown
> = z.object({
  type: z.literal("transcription.language"),
  audio_language: z.string(),
}).catchall(z.any()).transform((v) => {
  return remap$(v, {
    "audio_language": "audioLanguage",
  });
});
/** @internal */
export type TranscriptionStreamLanguage$Outbound = {
  type: "transcription.language";
  audio_language: string;
  [additionalProperties: string]: unknown;
};

/** @internal */
export const TranscriptionStreamLanguage$outboundSchema: z.ZodType<
  TranscriptionStreamLanguage$Outbound,
  TranscriptionStreamLanguage
> = z.object({
  type: z.literal("transcription.language"),
  audioLanguage: z.string(),
}).catchall(z.any()).transform((v) => {
  return {
    ...remap$(v, {
      audioLanguage: "audio_language",
    }),
  };
});

export function transcriptionStreamLanguageToJSON(
  transcriptionStreamLanguage: TranscriptionStreamLanguage,
): string {
  return JSON.stringify(
    TranscriptionStreamLanguage$outboundSchema.parse(
      transcriptionStreamLanguage,
    ),
  );
}
export function transcriptionStreamLanguageFromJSON(
  jsonString: string,
): SafeParseResult<TranscriptionStreamLanguage, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => TranscriptionStreamLanguage$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'TranscriptionStreamLanguage' from JSON`,
  );
}
