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

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 canceled events.
 */
export type CustomTaskCanceledAttributes = {
  /**
   * 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;
  /**
   * Optional reason provided for the cancellation.
   */
  reason?: string | null | undefined;
};

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

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