/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { SeverityLevelEnum, SeverityLevelEnum$inboundSchema, } from "./severitylevelenum.js"; /** * Custom data associated with the workflow */ export type SubscriptionPreferenceDtoData = {}; /** * Workflow information if this is a template-level preference */ export type SubscriptionPreferenceDtoWorkflow = { /** * Unique identifier of the workflow */ id: string; /** * Workflow identifier used for triggering */ identifier: string; /** * Human-readable name of the workflow */ name: string; /** * Whether this workflow is marked as critical */ critical: boolean; /** * Tags associated with the workflow */ tags?: Array | undefined; /** * Custom data associated with the workflow */ data?: SubscriptionPreferenceDtoData | undefined; /** * Severity of the workflow */ severity: SeverityLevelEnum; }; export type SubscriptionPreferenceDto = { /** * The unique identifier of the subscription */ subscriptionId: string; /** * Workflow information if this is a template-level preference */ workflow?: SubscriptionPreferenceDtoWorkflow | null | undefined; /** * Whether the preference is enabled */ enabled: boolean; /** * Optional condition using JSON Logic rules */ condition?: { [k: string]: any } | undefined; }; /** @internal */ export const SubscriptionPreferenceDtoData$inboundSchema: z.ZodType< SubscriptionPreferenceDtoData, z.ZodTypeDef, unknown > = z.object({}); export function subscriptionPreferenceDtoDataFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => SubscriptionPreferenceDtoData$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'SubscriptionPreferenceDtoData' from JSON`, ); } /** @internal */ export const SubscriptionPreferenceDtoWorkflow$inboundSchema: z.ZodType< SubscriptionPreferenceDtoWorkflow, z.ZodTypeDef, unknown > = z.object({ id: z.string(), identifier: z.string(), name: z.string(), critical: z.boolean(), tags: z.array(z.string()).optional(), data: z.lazy(() => SubscriptionPreferenceDtoData$inboundSchema).optional(), severity: SeverityLevelEnum$inboundSchema, }); export function subscriptionPreferenceDtoWorkflowFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => SubscriptionPreferenceDtoWorkflow$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'SubscriptionPreferenceDtoWorkflow' from JSON`, ); } /** @internal */ export const SubscriptionPreferenceDto$inboundSchema: z.ZodType< SubscriptionPreferenceDto, z.ZodTypeDef, unknown > = z.object({ subscriptionId: z.string(), workflow: z.nullable( z.lazy(() => SubscriptionPreferenceDtoWorkflow$inboundSchema), ).optional(), enabled: z.boolean(), condition: z.record(z.any()).optional(), }); export function subscriptionPreferenceDtoFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => SubscriptionPreferenceDto$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'SubscriptionPreferenceDto' from JSON`, ); }