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

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";

/**
 * Attributes for workflow task timed out events.
 */
export type WorkflowTaskTimedOutAttributes = {
  /**
   * Unique identifier for the task within the workflow execution.
   */
  taskId: string;
  /**
   * The type of timeout that occurred (e.g., 'START_TO_CLOSE', 'SCHEDULE_TO_START').
   */
  timeoutType?: string | null | undefined;
};

/** @internal */
export const WorkflowTaskTimedOutAttributes$inboundSchema: z.ZodType<
  WorkflowTaskTimedOutAttributes,
  unknown
> = z.object({
  task_id: z.string(),
  timeout_type: z.nullable(z.string()).optional(),
}).transform((v) => {
  return remap$(v, {
    "task_id": "taskId",
    "timeout_type": "timeoutType",
  });
});

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