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

import * as z from "zod/v4";
import { smartUnion } from "../../types/smartUnion.js";
import {
  NetworkEncodedInput,
  NetworkEncodedInput$Outbound,
  NetworkEncodedInput$outboundSchema,
} from "./networkencodedinput.js";

/**
 * Input data for the update, matching its schema
 */
export type UpdateInvocationBodyInput = NetworkEncodedInput | {
  [k: string]: any;
};

export type UpdateInvocationBody = {
  /**
   * The name of the update to request
   */
  name: string;
  /**
   * Input data for the update, matching its schema
   */
  input?: NetworkEncodedInput | { [k: string]: any } | null | undefined;
};

/** @internal */
export type UpdateInvocationBodyInput$Outbound =
  | NetworkEncodedInput$Outbound
  | { [k: string]: any };

/** @internal */
export const UpdateInvocationBodyInput$outboundSchema: z.ZodType<
  UpdateInvocationBodyInput$Outbound,
  UpdateInvocationBodyInput
> = smartUnion([
  NetworkEncodedInput$outboundSchema,
  z.record(z.string(), z.any()),
]);

export function updateInvocationBodyInputToJSON(
  updateInvocationBodyInput: UpdateInvocationBodyInput,
): string {
  return JSON.stringify(
    UpdateInvocationBodyInput$outboundSchema.parse(updateInvocationBodyInput),
  );
}

/** @internal */
export type UpdateInvocationBody$Outbound = {
  name: string;
  input?:
    | NetworkEncodedInput$Outbound
    | { [k: string]: any }
    | null
    | undefined;
};

/** @internal */
export const UpdateInvocationBody$outboundSchema: z.ZodType<
  UpdateInvocationBody$Outbound,
  UpdateInvocationBody
> = z.object({
  name: z.string(),
  input: z.nullable(
    smartUnion([
      NetworkEncodedInput$outboundSchema,
      z.record(z.string(), z.any()),
    ]),
  ).optional(),
});

export function updateInvocationBodyToJSON(
  updateInvocationBody: UpdateInvocationBody,
): string {
  return JSON.stringify(
    UpdateInvocationBody$outboundSchema.parse(updateInvocationBody),
  );
}
