/*
 * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
 * @generated-id: 22faf5428a28
 */

import * as z from "zod/v4";
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 {
  JSONPayloadResponse,
  JSONPayloadResponse$inboundSchema,
} from "./jsonpayloadresponse.js";

/**
 * Attributes for workflow execution started events.
 */
export type WorkflowExecutionStartedAttributesResponse = {
  /**
   * Unique identifier for the task within the workflow execution.
   */
  taskId: string;
  /**
   * The registered name of the workflow being executed.
   */
  workflowName: string;
  /**
   * The user-friendly display name of the workflow, if available.
   */
  displayName?: string | null | undefined;
  /**
   * A payload containing arbitrary JSON data.
   *
   * @remarks
   *
   * Used for complete state snapshots or final results.
   * When encrypted, the value field contains base64-encoded encrypted data
   * and encoding_options indicates the type of encryption applied.
   */
  input: JSONPayloadResponse;
};

/** @internal */
export const WorkflowExecutionStartedAttributesResponse$inboundSchema:
  z.ZodType<WorkflowExecutionStartedAttributesResponse, unknown> = z.object({
    task_id: z.string(),
    workflow_name: z.string(),
    display_name: z.nullable(z.string()).optional(),
    input: JSONPayloadResponse$inboundSchema,
  }).transform((v) => {
    return remap$(v, {
      "task_id": "taskId",
      "workflow_name": "workflowName",
      "display_name": "displayName",
    });
  });

export function workflowExecutionStartedAttributesResponseFromJSON(
  jsonString: string,
): SafeParseResult<
  WorkflowExecutionStartedAttributesResponse,
  SDKValidationError
> {
  return safeParse(
    jsonString,
    (x) =>
      WorkflowExecutionStartedAttributesResponse$inboundSchema.parse(
        JSON.parse(x),
      ),
    `Failed to parse 'WorkflowExecutionStartedAttributesResponse' from JSON`,
  );
}
