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

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 custom task timed out events.
 */
export type CustomTaskTimedOutAttributes = {
  /**
   * Unique identifier for the custom task within the workflow.
   */
  customTaskId: string;
  /**
   * The type/category of the custom task (e.g., 'llm_call', 'api_request').
   */
  customTaskType: string;
  /**
   * The type of timeout that occurred.
   */
  timeoutType?: string | null | undefined;
};

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

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