/*
 * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
 * @generated-id: 98c38f18d407
 */
import * as z from "zod/v4";
import { remap as remap$ } from "../../lib/primitives.js";
import { safeParse } from "../../lib/schemas.js";
import { smartUnion } from "../../types/smartUnion.js";
import { Annotations$inboundSchema } from "./annotations.js";
import { BlobResourceContents$inboundSchema, } from "./blobresourcecontents.js";
import { TextResourceContents$inboundSchema, } from "./textresourcecontents.js";
/** @internal */
export const Resource$inboundSchema = smartUnion([
    TextResourceContents$inboundSchema,
    BlobResourceContents$inboundSchema,
]);
export function resourceFromJSON(jsonString) {
    return safeParse(jsonString, (x) => Resource$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Resource' from JSON`);
}
/** @internal */
export const EmbeddedResource$inboundSchema = z.object({
    type: z.literal("resource"),
    resource: smartUnion([
        TextResourceContents$inboundSchema,
        BlobResourceContents$inboundSchema,
    ]),
    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 embeddedResourceFromJSON(jsonString) {
    return safeParse(jsonString, (x) => EmbeddedResource$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'EmbeddedResource' from JSON`);
}
//# sourceMappingURL=embeddedresource.js.map