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

import * as z from "zod/v3";
import {
  TextChunk,
  TextChunk$Outbound,
  TextChunk$outboundSchema,
} from "./textchunk.js";
import {
  ThinkChunk,
  ThinkChunk$Outbound,
  ThinkChunk$outboundSchema,
} from "./thinkchunk.js";

export type SystemMessageContentChunks =
  | (TextChunk & { type: "text" })
  | (ThinkChunk & { type: "thinking" });

/** @internal */
export type SystemMessageContentChunks$Outbound =
  | (TextChunk$Outbound & { type: "text" })
  | (ThinkChunk$Outbound & { type: "thinking" });

/** @internal */
export const SystemMessageContentChunks$outboundSchema: z.ZodType<
  SystemMessageContentChunks$Outbound,
  z.ZodTypeDef,
  SystemMessageContentChunks
> = z.union([
  TextChunk$outboundSchema.and(z.object({ type: z.literal("text") })),
  ThinkChunk$outboundSchema.and(z.object({ type: z.literal("thinking") })),
]);

export function systemMessageContentChunksToJSON(
  systemMessageContentChunks: SystemMessageContentChunks,
): string {
  return JSON.stringify(
    SystemMessageContentChunks$outboundSchema.parse(systemMessageContentChunks),
  );
}
