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

import * as z from "zod/v4";
import { remap as remap$ } from "../../lib/primitives.js";

export type WorkflowExecutionRequest = {
  /**
   * Allows you to specify a custom execution ID. If not provided, a random ID will be generated.
   */
  executionId?: string | null | undefined;
  /**
   * The input to the workflow. This should be a dictionary or a BaseModel that matches the workflow's input schema.
   */
  input?: any | null | undefined;
  /**
   * If true, wait for the workflow to complete and return the result directly.
   */
  waitForResult?: boolean | undefined;
  /**
   * Maximum time to wait for completion when wait_for_result is true.
   */
  timeoutSeconds?: number | null | undefined;
  customTracingAttributes?: { [k: string]: string } | null | undefined;
  /**
   * Plugin-specific data to propagate into WorkflowContext.extensions at execution time.
   */
  extensions?: { [k: string]: any } | null | undefined;
  /**
   * Deprecated. Use deployment_name instead.
   *
   * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible.
   */
  taskQueue?: string | null | undefined;
  /**
   * Name of the deployment to route this execution to
   */
  deploymentName?: string | null | undefined;
};

/** @internal */
export type WorkflowExecutionRequest$Outbound = {
  execution_id?: string | null | undefined;
  input?: any | null | undefined;
  wait_for_result: boolean;
  timeout_seconds?: number | null | undefined;
  custom_tracing_attributes?: { [k: string]: string } | null | undefined;
  extensions?: { [k: string]: any } | null | undefined;
  task_queue?: string | null | undefined;
  deployment_name?: string | null | undefined;
};

/** @internal */
export const WorkflowExecutionRequest$outboundSchema: z.ZodType<
  WorkflowExecutionRequest$Outbound,
  WorkflowExecutionRequest
> = z.object({
  executionId: z.nullable(z.string()).optional(),
  input: z.nullable(z.any()).optional(),
  waitForResult: z.boolean().default(false),
  timeoutSeconds: z.nullable(z.number()).optional(),
  customTracingAttributes: z.nullable(z.record(z.string(), z.string()))
    .optional(),
  extensions: z.nullable(z.record(z.string(), z.any())).optional(),
  taskQueue: z.nullable(z.string()).optional(),
  deploymentName: z.nullable(z.string()).optional(),
}).transform((v) => {
  return remap$(v, {
    executionId: "execution_id",
    waitForResult: "wait_for_result",
    timeoutSeconds: "timeout_seconds",
    customTracingAttributes: "custom_tracing_attributes",
    taskQueue: "task_queue",
    deploymentName: "deployment_name",
  });
});

export function workflowExecutionRequestToJSON(
  workflowExecutionRequest: WorkflowExecutionRequest,
): string {
  return JSON.stringify(
    WorkflowExecutionRequest$outboundSchema.parse(workflowExecutionRequest),
  );
}
