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

import * as z from "zod/v3";
import { safeParse } from "../../lib/schemas.js";
import { Result as SafeParseResult } from "../../types/fp.js";
import { SDKValidationError } from "../errors/sdkvalidationerror.js";

export type ExperimentPatchInput = {
  /**
   * Optional comment describing the update
   */
  comment?: string | undefined;
  instructions: Array<{ [k: string]: any }>;
};

/** @internal */
export const ExperimentPatchInput$inboundSchema: z.ZodType<
  ExperimentPatchInput,
  z.ZodTypeDef,
  unknown
> = z.object({
  comment: z.string().optional(),
  instructions: z.array(z.record(z.any())),
});
/** @internal */
export type ExperimentPatchInput$Outbound = {
  comment?: string | undefined;
  instructions: Array<{ [k: string]: any }>;
};

/** @internal */
export const ExperimentPatchInput$outboundSchema: z.ZodType<
  ExperimentPatchInput$Outbound,
  z.ZodTypeDef,
  ExperimentPatchInput
> = z.object({
  comment: z.string().optional(),
  instructions: z.array(z.record(z.any())),
});

export function experimentPatchInputToJSON(
  experimentPatchInput: ExperimentPatchInput,
): string {
  return JSON.stringify(
    ExperimentPatchInput$outboundSchema.parse(experimentPatchInput),
  );
}
export function experimentPatchInputFromJSON(
  jsonString: string,
): SafeParseResult<ExperimentPatchInput, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => ExperimentPatchInput$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'ExperimentPatchInput' from JSON`,
  );
}
