/*
 * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
 * @generated-id: ea31fd796d04
 */
import * as z from "zod/v4";
import { remap as remap$ } from "../../lib/primitives.js";
import { safeParse } from "../../lib/schemas.js";
import { smartUnion } from "../../types/smartUnion.js";
import { ActivityTaskCompletedResponse$inboundSchema, } from "./activitytaskcompletedresponse.js";
import { ActivityTaskFailedResponse$inboundSchema, } from "./activitytaskfailedresponse.js";
import { ActivityTaskRetryingResponse$inboundSchema, } from "./activitytaskretryingresponse.js";
import { ActivityTaskStartedResponse$inboundSchema, } from "./activitytaskstartedresponse.js";
import { CustomTaskCanceledResponse$inboundSchema, } from "./customtaskcanceledresponse.js";
import { CustomTaskCompletedResponse$inboundSchema, } from "./customtaskcompletedresponse.js";
import { CustomTaskFailedResponse$inboundSchema, } from "./customtaskfailedresponse.js";
import { CustomTaskInProgressResponse$inboundSchema, } from "./customtaskinprogressresponse.js";
import { CustomTaskStartedResponse$inboundSchema, } from "./customtaskstartedresponse.js";
import { CustomTaskTimedOutResponse$inboundSchema, } from "./customtasktimedoutresponse.js";
import { StreamEventWorkflowContext$inboundSchema, } from "./streameventworkflowcontext.js";
import { WorkflowExecutionCanceledResponse$inboundSchema, } from "./workflowexecutioncanceledresponse.js";
import { WorkflowExecutionCompletedResponse$inboundSchema, } from "./workflowexecutioncompletedresponse.js";
import { WorkflowExecutionContinuedAsNewResponse$inboundSchema, } from "./workflowexecutioncontinuedasnewresponse.js";
import { WorkflowExecutionFailedResponse$inboundSchema, } from "./workflowexecutionfailedresponse.js";
import { WorkflowExecutionStartedResponse$inboundSchema, } from "./workflowexecutionstartedresponse.js";
import { WorkflowTaskFailedResponse$inboundSchema, } from "./workflowtaskfailedresponse.js";
import { WorkflowTaskTimedOutResponse$inboundSchema, } from "./workflowtasktimedoutresponse.js";
/** @internal */
export const StreamEventSsePayloadData$inboundSchema = smartUnion([
    WorkflowExecutionStartedResponse$inboundSchema,
    WorkflowExecutionCompletedResponse$inboundSchema,
    WorkflowExecutionFailedResponse$inboundSchema,
    WorkflowExecutionCanceledResponse$inboundSchema,
    WorkflowExecutionContinuedAsNewResponse$inboundSchema,
    WorkflowTaskTimedOutResponse$inboundSchema,
    WorkflowTaskFailedResponse$inboundSchema,
    CustomTaskStartedResponse$inboundSchema,
    CustomTaskInProgressResponse$inboundSchema,
    CustomTaskCompletedResponse$inboundSchema,
    CustomTaskFailedResponse$inboundSchema,
    CustomTaskTimedOutResponse$inboundSchema,
    CustomTaskCanceledResponse$inboundSchema,
    ActivityTaskStartedResponse$inboundSchema,
    ActivityTaskCompletedResponse$inboundSchema,
    ActivityTaskRetryingResponse$inboundSchema,
    ActivityTaskFailedResponse$inboundSchema,
]);
export function streamEventSsePayloadDataFromJSON(jsonString) {
    return safeParse(jsonString, (x) => StreamEventSsePayloadData$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'StreamEventSsePayloadData' from JSON`);
}
/** @internal */
export const StreamEventSsePayload$inboundSchema = z.object({
    stream: z.string(),
    timestamp: z.iso.datetime({ offset: true }).transform(v => new Date(v))
        .optional(),
    data: smartUnion([
        WorkflowExecutionStartedResponse$inboundSchema,
        WorkflowExecutionCompletedResponse$inboundSchema,
        WorkflowExecutionFailedResponse$inboundSchema,
        WorkflowExecutionCanceledResponse$inboundSchema,
        WorkflowExecutionContinuedAsNewResponse$inboundSchema,
        WorkflowTaskTimedOutResponse$inboundSchema,
        WorkflowTaskFailedResponse$inboundSchema,
        CustomTaskStartedResponse$inboundSchema,
        CustomTaskInProgressResponse$inboundSchema,
        CustomTaskCompletedResponse$inboundSchema,
        CustomTaskFailedResponse$inboundSchema,
        CustomTaskTimedOutResponse$inboundSchema,
        CustomTaskCanceledResponse$inboundSchema,
        ActivityTaskStartedResponse$inboundSchema,
        ActivityTaskCompletedResponse$inboundSchema,
        ActivityTaskRetryingResponse$inboundSchema,
        ActivityTaskFailedResponse$inboundSchema,
    ]),
    workflow_context: StreamEventWorkflowContext$inboundSchema,
    metadata: z.record(z.string(), z.any()).optional(),
    broker_sequence: z.int(),
}).transform((v) => {
    return remap$(v, {
        "workflow_context": "workflowContext",
        "broker_sequence": "brokerSequence",
    });
});
export function streamEventSsePayloadFromJSON(jsonString) {
    return safeParse(jsonString, (x) => StreamEventSsePayload$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'StreamEventSsePayload' from JSON`);
}
//# sourceMappingURL=streameventssepayload.js.map