/*
 * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
 */
import * as z from "zod";
import { safeParse } from "../../lib/schemas.js";
import { ConversationsAggregationSelection$inboundSchema, ConversationsAggregationSelection$outboundSchema, } from "./conversationsaggregationselection.js";
import { ConversationsSimpleFieldSelection$inboundSchema, ConversationsSimpleFieldSelection$outboundSchema, } from "./conversationssimplefieldselection.js";
import { ConversationsTimeBasedGroupBySelection$inboundSchema, ConversationsTimeBasedGroupBySelection$outboundSchema, } from "./conversationstimebasedgroupbyselection.js";
/** @internal */
export const ConversationsSelection$inboundSchema = z.union([
    ConversationsSimpleFieldSelection$inboundSchema.and(z.object({ type: z.literal("field") }).transform((v) => ({ type: v.type }))),
    ConversationsAggregationSelection$inboundSchema.and(z.object({ type: z.literal("aggregation") }).transform((v) => ({
        type: v.type,
    }))),
    ConversationsTimeBasedGroupBySelection$inboundSchema.and(z.object({ type: z.literal("time") }).transform((v) => ({ type: v.type }))),
]);
/** @internal */
export const ConversationsSelection$outboundSchema = z.union([
    ConversationsSimpleFieldSelection$outboundSchema.and(z.object({ type: z.literal("field") }).transform((v) => ({ type: v.type }))),
    ConversationsAggregationSelection$outboundSchema.and(z.object({ type: z.literal("aggregation") }).transform((v) => ({
        type: v.type,
    }))),
    ConversationsTimeBasedGroupBySelection$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 ConversationsSelection$;
(function (ConversationsSelection$) {
    /** @deprecated use `ConversationsSelection$inboundSchema` instead. */
    ConversationsSelection$.inboundSchema = ConversationsSelection$inboundSchema;
    /** @deprecated use `ConversationsSelection$outboundSchema` instead. */
    ConversationsSelection$.outboundSchema = ConversationsSelection$outboundSchema;
})(ConversationsSelection$ || (ConversationsSelection$ = {}));
export function conversationsSelectionToJSON(conversationsSelection) {
    return JSON.stringify(ConversationsSelection$outboundSchema.parse(conversationsSelection));
}
export function conversationsSelectionFromJSON(jsonString) {
    return safeParse(jsonString, (x) => ConversationsSelection$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ConversationsSelection' from JSON`);
}
//# sourceMappingURL=conversationsselection.js.map