/*
 * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
 */
import * as z from "zod";
import { safeParse } from "../../lib/schemas.js";
import { EventsAggregationSelection$inboundSchema, EventsAggregationSelection$outboundSchema, } from "./eventsaggregationselection.js";
import { EventsSimpleFieldSelection$inboundSchema, EventsSimpleFieldSelection$outboundSchema, } from "./eventssimplefieldselection.js";
import { EventsTimeBasedGroupBySelection$inboundSchema, EventsTimeBasedGroupBySelection$outboundSchema, } from "./eventstimebasedgroupbyselection.js";
/** @internal */
export const EventsSelection$inboundSchema = z.union([
    EventsSimpleFieldSelection$inboundSchema.and(z.object({ type: z.literal("field") }).transform((v) => ({ type: v.type }))),
    EventsAggregationSelection$inboundSchema.and(z.object({ type: z.literal("aggregation") }).transform((v) => ({
        type: v.type,
    }))),
    EventsTimeBasedGroupBySelection$inboundSchema.and(z.object({ type: z.literal("time") }).transform((v) => ({ type: v.type }))),
]);
/** @internal */
export const EventsSelection$outboundSchema = z.union([
    EventsSimpleFieldSelection$outboundSchema.and(z.object({ type: z.literal("field") }).transform((v) => ({ type: v.type }))),
    EventsAggregationSelection$outboundSchema.and(z.object({ type: z.literal("aggregation") }).transform((v) => ({
        type: v.type,
    }))),
    EventsTimeBasedGroupBySelection$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 EventsSelection$;
(function (EventsSelection$) {
    /** @deprecated use `EventsSelection$inboundSchema` instead. */
    EventsSelection$.inboundSchema = EventsSelection$inboundSchema;
    /** @deprecated use `EventsSelection$outboundSchema` instead. */
    EventsSelection$.outboundSchema = EventsSelection$outboundSchema;
})(EventsSelection$ || (EventsSelection$ = {}));
export function eventsSelectionToJSON(eventsSelection) {
    return JSON.stringify(EventsSelection$outboundSchema.parse(eventsSelection));
}
export function eventsSelectionFromJSON(jsonString) {
    return safeParse(jsonString, (x) => EventsSelection$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'EventsSelection' from JSON`);
}
//# sourceMappingURL=eventsselection.js.map