/*
 * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
 * @generated-id: e87fccde404b
 */
import * as z from "zod/v4";
import { safeParse } from "../../lib/schemas.js";
import { smartUnion } from "../../types/smartUnion.js";
import { FilterCondition$inboundSchema, FilterCondition$outboundSchema, } from "./filtercondition.js";
import { FilterGroup$inboundSchema, FilterGroup$outboundSchema, } from "./filtergroup.js";
/** @internal */
export const Filters$inboundSchema = smartUnion([
    FilterCondition$inboundSchema,
    FilterGroup$inboundSchema,
]);
/** @internal */
export const Filters$outboundSchema = smartUnion([FilterCondition$outboundSchema, FilterGroup$outboundSchema]);
export function filtersToJSON(filters) {
    return JSON.stringify(Filters$outboundSchema.parse(filters));
}
export function filtersFromJSON(jsonString) {
    return safeParse(jsonString, (x) => Filters$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Filters' from JSON`);
}
/** @internal */
export const FilterPayload$inboundSchema = z
    .object({
    filters: z.nullable(smartUnion([FilterCondition$inboundSchema, FilterGroup$inboundSchema])),
});
/** @internal */
export const FilterPayload$outboundSchema = z.object({
    filters: z.nullable(smartUnion([FilterCondition$outboundSchema, FilterGroup$outboundSchema])),
});
export function filterPayloadToJSON(filterPayload) {
    return JSON.stringify(FilterPayload$outboundSchema.parse(filterPayload));
}
export function filterPayloadFromJSON(jsonString) {
    return safeParse(jsonString, (x) => FilterPayload$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'FilterPayload' from JSON`);
}
//# sourceMappingURL=filterpayload.js.map