/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { remap as remap$ } from "../../lib/primitives.js"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { DelayRegularMetadata, DelayRegularMetadata$inboundSchema, } from "./delayregularmetadata.js"; import { DelayScheduledMetadata, DelayScheduledMetadata$inboundSchema, } from "./delayscheduledmetadata.js"; import { DigestRegularMetadata, DigestRegularMetadata$inboundSchema, } from "./digestregularmetadata.js"; import { DigestTimedMetadata, DigestTimedMetadata$inboundSchema, } from "./digesttimedmetadata.js"; import { MessageTemplate, MessageTemplate$inboundSchema, } from "./messagetemplate.js"; import { ReplyCallback, ReplyCallback$inboundSchema } from "./replycallback.js"; import { StepFilterDto, StepFilterDto$inboundSchema } from "./stepfilterdto.js"; /** * Metadata associated with the workflow step. Can vary based on the type of step. */ export type NotificationStepDataMetadata = | DelayScheduledMetadata | DigestRegularMetadata | DigestTimedMetadata | DelayRegularMetadata; export type NotificationStepData = { /** * Unique identifier for the notification step. */ id?: string | undefined; /** * Universally unique identifier for the notification step. */ uuid?: string | undefined; /** * Name of the notification step. */ name?: string | undefined; /** * ID of the template associated with this notification step. */ templateId?: string | undefined; /** * Indicates whether the notification step is active. */ active?: boolean | undefined; /** * Determines if the process should stop on failure. */ shouldStopOnFail?: boolean | undefined; /** * Message template used in this notification step. */ template?: MessageTemplate | undefined; /** * Filters applied to this notification step. */ filters?: Array | undefined; /** * ID of the parent notification step, if applicable. */ parentId?: string | undefined; /** * Metadata associated with the workflow step. Can vary based on the type of step. */ metadata?: | DelayScheduledMetadata | DigestRegularMetadata | DigestTimedMetadata | DelayRegularMetadata | undefined; /** * Callback information for replies, including whether it is active and the callback URL. */ replyCallback?: ReplyCallback | undefined; }; /** @internal */ export const NotificationStepDataMetadata$inboundSchema: z.ZodType< NotificationStepDataMetadata, z.ZodTypeDef, unknown > = z.union([ DelayScheduledMetadata$inboundSchema, DigestRegularMetadata$inboundSchema, DigestTimedMetadata$inboundSchema, DelayRegularMetadata$inboundSchema, ]); export function notificationStepDataMetadataFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => NotificationStepDataMetadata$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'NotificationStepDataMetadata' from JSON`, ); } /** @internal */ export const NotificationStepData$inboundSchema: z.ZodType< NotificationStepData, z.ZodTypeDef, unknown > = z.object({ _id: z.string().optional(), uuid: z.string().optional(), name: z.string().optional(), _templateId: z.string().optional(), active: z.boolean().optional(), shouldStopOnFail: z.boolean().optional(), template: MessageTemplate$inboundSchema.optional(), filters: z.array(StepFilterDto$inboundSchema).optional(), _parentId: z.string().optional(), metadata: z.union([ DelayScheduledMetadata$inboundSchema, DigestRegularMetadata$inboundSchema, DigestTimedMetadata$inboundSchema, DelayRegularMetadata$inboundSchema, ]).optional(), replyCallback: ReplyCallback$inboundSchema.optional(), }).transform((v) => { return remap$(v, { "_id": "id", "_templateId": "templateId", "_parentId": "parentId", }); }); export function notificationStepDataFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => NotificationStepData$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'NotificationStepData' from JSON`, ); }