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

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

export type RealtimeTranscriptionSessionCreated = {
  type?: "session.created" | undefined;
  session: RealtimeTranscriptionSession;
};

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

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

export function realtimeTranscriptionSessionCreatedToJSON(
  realtimeTranscriptionSessionCreated: RealtimeTranscriptionSessionCreated,
): string {
  return JSON.stringify(
    RealtimeTranscriptionSessionCreated$outboundSchema.parse(
      realtimeTranscriptionSessionCreated,
    ),
  );
}
export function realtimeTranscriptionSessionCreatedFromJSON(
  jsonString: string,
): SafeParseResult<RealtimeTranscriptionSessionCreated, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) =>
      RealtimeTranscriptionSessionCreated$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'RealtimeTranscriptionSessionCreated' from JSON`,
  );
}
