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