/*
 * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
 * @generated-id: 928b2a3573d6
 */
import * as z from "zod/v4";
import { remap as remap$ } from "../../lib/primitives.js";
import { safeParse } from "../../lib/schemas.js";
import * as openEnums from "../../types/enums.js";
import { smartUnion } from "../../types/smartUnion.js";
import * as components from "../components/index.js";
export const Event = {
    Log: "log",
    Error: "error",
};
/** @internal */
export const StreamWorkflowExecutionLogsRequest$outboundSchema = z.object({
    executionId: z.string(),
    runId: z.nullable(z.string()).optional(),
    activityId: z.nullable(z.string()).optional(),
    after: z.nullable(z.date().transform(v => v.toISOString())).optional(),
    lastEventId: z.nullable(z.string()).optional(),
}).transform((v) => {
    return remap$(v, {
        executionId: "execution_id",
        runId: "run_id",
        activityId: "activity_id",
        lastEventId: "last_event_id",
    });
});
export function streamWorkflowExecutionLogsRequestToJSON(streamWorkflowExecutionLogsRequest) {
    return JSON.stringify(StreamWorkflowExecutionLogsRequest$outboundSchema.parse(streamWorkflowExecutionLogsRequest));
}
/** @internal */
export const Event$inboundSchema = openEnums
    .inboundSchema(Event);
/** @internal */
export const StreamWorkflowExecutionLogsData$inboundSchema = smartUnion([
    components.ExecutionLogRecord$inboundSchema,
    components.StreamError$inboundSchema,
]);
export function streamWorkflowExecutionLogsDataFromJSON(jsonString) {
    return safeParse(jsonString, (x) => StreamWorkflowExecutionLogsData$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'StreamWorkflowExecutionLogsData' from JSON`);
}
/** @internal */
export const StreamWorkflowExecutionLogsResponseBody$inboundSchema = z.object({
    event: Event$inboundSchema.optional(),
    id: z.string().optional(),
    data: z.string().optional().transform((v, ctx) => {
        if (v === undefined)
            return undefined;
        try {
            return JSON.parse(v);
        }
        catch (err) {
            ctx.addIssue({
                input: v,
                code: "custom",
                message: `malformed json: ${err}`,
            });
            return z.NEVER;
        }
    }).pipe(smartUnion([
        components.ExecutionLogRecord$inboundSchema,
        components.StreamError$inboundSchema,
    ]).optional()),
});
export function streamWorkflowExecutionLogsResponseBodyFromJSON(jsonString) {
    return safeParse(jsonString, (x) => StreamWorkflowExecutionLogsResponseBody$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'StreamWorkflowExecutionLogsResponseBody' from JSON`);
}
//# sourceMappingURL=streamworkflowexecutionlogs.js.map