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

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";
import { Annotations, Annotations$inboundSchema } from "./annotations.js";

/**
 * Image content for a message.
 */
export type ImageContent = {
  type: "image";
  data: string;
  mimeType: string;
  annotations?: Annotations | null | undefined;
  meta?: { [k: string]: any } | null | undefined;
  [additionalProperties: string]: unknown;
};

/** @internal */
export const ImageContent$inboundSchema: z.ZodType<ImageContent, unknown> = z
  .object({
    type: z.literal("image"),
    data: z.string(),
    mimeType: z.string(),
    annotations: z.nullable(Annotations$inboundSchema).optional(),
    _meta: z.nullable(z.record(z.string(), z.any())).optional(),
  }).catchall(z.any()).transform((v) => {
    return remap$(v, {
      "_meta": "meta",
    });
  });

export function imageContentFromJSON(
  jsonString: string,
): SafeParseResult<ImageContent, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => ImageContent$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'ImageContent' from JSON`,
  );
}
