/*
 * 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";
import {
  RealtimeTranscriptionSession,
  RealtimeTranscriptionSession$inboundSchema,
  RealtimeTranscriptionSession$Outbound,
  RealtimeTranscriptionSession$outboundSchema,
} from "./realtimetranscriptionsession.js";

export type RealtimeTranscriptionSessionUpdated = {
  type?: "session.updated" | undefined;
  session: RealtimeTranscriptionSession;
};

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

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

export function realtimeTranscriptionSessionUpdatedToJSON(
  realtimeTranscriptionSessionUpdated: RealtimeTranscriptionSessionUpdated,
): string {
  return JSON.stringify(
    RealtimeTranscriptionSessionUpdated$outboundSchema.parse(
      realtimeTranscriptionSessionUpdated,
    ),
  );
}
export function realtimeTranscriptionSessionUpdatedFromJSON(
  jsonString: string,
): SafeParseResult<RealtimeTranscriptionSessionUpdated, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) =>
      RealtimeTranscriptionSessionUpdated$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'RealtimeTranscriptionSessionUpdated' from JSON`,
  );
}
