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

import * as z from "zod/v3";
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";
import {
  AudioFormat,
  AudioFormat$inboundSchema,
  AudioFormat$Outbound,
  AudioFormat$outboundSchema,
} from "./audioformat.js";

export type RealtimeTranscriptionSession = {
  requestId: string;
  model: string;
  audioFormat: AudioFormat;
};

/** @internal */
export const RealtimeTranscriptionSession$inboundSchema: z.ZodType<
  RealtimeTranscriptionSession,
  z.ZodTypeDef,
  unknown
> = z.object({
  request_id: z.string(),
  model: z.string(),
  audio_format: AudioFormat$inboundSchema,
}).transform((v) => {
  return remap$(v, {
    "request_id": "requestId",
    "audio_format": "audioFormat",
  });
});
/** @internal */
export type RealtimeTranscriptionSession$Outbound = {
  request_id: string;
  model: string;
  audio_format: AudioFormat$Outbound;
};

/** @internal */
export const RealtimeTranscriptionSession$outboundSchema: z.ZodType<
  RealtimeTranscriptionSession$Outbound,
  z.ZodTypeDef,
  RealtimeTranscriptionSession
> = z.object({
  requestId: z.string(),
  model: z.string(),
  audioFormat: AudioFormat$outboundSchema,
}).transform((v) => {
  return remap$(v, {
    requestId: "request_id",
    audioFormat: "audio_format",
  });
});

export function realtimeTranscriptionSessionToJSON(
  realtimeTranscriptionSession: RealtimeTranscriptionSession,
): string {
  return JSON.stringify(
    RealtimeTranscriptionSession$outboundSchema.parse(
      realtimeTranscriptionSession,
    ),
  );
}
export function realtimeTranscriptionSessionFromJSON(
  jsonString: string,
): SafeParseResult<RealtimeTranscriptionSession, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => RealtimeTranscriptionSession$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'RealtimeTranscriptionSession' from JSON`,
  );
}
