/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v4-mini"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import * as types from "../../types/primitives.js"; import { AlertCondition, AlertCondition$inboundSchema, AlertCondition$outboundSchema, } from "./alert-condition.js"; import { SDKValidationError } from "./sdk-validation-error.js"; export type AlertThreshold = { condition?: AlertCondition | undefined; threshold?: string | undefined; }; /** @internal */ export const AlertThreshold$inboundSchema: z.ZodMiniType< AlertThreshold, unknown > = z.object({ condition: types.optional(AlertCondition$inboundSchema), threshold: types.optional(types.string()), }); /** @internal */ export type AlertThreshold$Outbound = { condition?: string | undefined; threshold?: string | undefined; }; /** @internal */ export const AlertThreshold$outboundSchema: z.ZodMiniType< AlertThreshold$Outbound, AlertThreshold > = z.object({ condition: z.optional(AlertCondition$outboundSchema), threshold: z.optional(z.string()), }); export function alertThresholdToJSON(alertThreshold: AlertThreshold): string { return JSON.stringify(AlertThreshold$outboundSchema.parse(alertThreshold)); } export function alertThresholdFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AlertThreshold$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AlertThreshold' from JSON`, ); }