/*
 * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
 */
import * as z from "zod";
import { safeParse } from "../../lib/schemas.js";
import { SemanticThreadAggregationSelection$inboundSchema, SemanticThreadAggregationSelection$outboundSchema, } from "./semanticthreadaggregationselection.js";
import { SemanticThreadSimpleFieldSelection$inboundSchema, SemanticThreadSimpleFieldSelection$outboundSchema, } from "./semanticthreadsimplefieldselection.js";
import { SemanticThreadTimeBasedGroupBySelection$inboundSchema, SemanticThreadTimeBasedGroupBySelection$outboundSchema, } from "./semanticthreadtimebasedgroupbyselection.js";
/** @internal */
export const SemanticThreadSelection$inboundSchema = z.union([
    SemanticThreadSimpleFieldSelection$inboundSchema.and(z.object({ type: z.literal("field") }).transform((v) => ({ type: v.type }))),
    SemanticThreadAggregationSelection$inboundSchema.and(z.object({ type: z.literal("aggregation") }).transform((v) => ({
        type: v.type,
    }))),
    SemanticThreadTimeBasedGroupBySelection$inboundSchema.and(z.object({ type: z.literal("time") }).transform((v) => ({ type: v.type }))),
]);
/** @internal */
export const SemanticThreadSelection$outboundSchema = z.union([
    SemanticThreadSimpleFieldSelection$outboundSchema.and(z.object({ type: z.literal("field") }).transform((v) => ({ type: v.type }))),
    SemanticThreadAggregationSelection$outboundSchema.and(z.object({ type: z.literal("aggregation") }).transform((v) => ({
        type: v.type,
    }))),
    SemanticThreadTimeBasedGroupBySelection$outboundSchema.and(z.object({ type: z.literal("time") }).transform((v) => ({ type: v.type }))),
]);
/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
export var SemanticThreadSelection$;
(function (SemanticThreadSelection$) {
    /** @deprecated use `SemanticThreadSelection$inboundSchema` instead. */
    SemanticThreadSelection$.inboundSchema = SemanticThreadSelection$inboundSchema;
    /** @deprecated use `SemanticThreadSelection$outboundSchema` instead. */
    SemanticThreadSelection$.outboundSchema = SemanticThreadSelection$outboundSchema;
})(SemanticThreadSelection$ || (SemanticThreadSelection$ = {}));
export function semanticThreadSelectionToJSON(semanticThreadSelection) {
    return JSON.stringify(SemanticThreadSelection$outboundSchema.parse(semanticThreadSelection));
}
export function semanticThreadSelectionFromJSON(jsonString) {
    return safeParse(jsonString, (x) => SemanticThreadSelection$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'SemanticThreadSelection' from JSON`);
}
//# sourceMappingURL=semanticthreadselection.js.map