/*
 * 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";
import {
  AiConfigsLegacyExperimentRep,
  AiConfigsLegacyExperimentRep$inboundSchema,
  AiConfigsLegacyExperimentRep$Outbound,
  AiConfigsLegacyExperimentRep$outboundSchema,
} from "./aiconfigslegacyexperimentrep.js";

export type AiConfigsExperimentInfoRep = {
  baselineIdx: number;
  items: Array<AiConfigsLegacyExperimentRep>;
};

/** @internal */
export const AiConfigsExperimentInfoRep$inboundSchema: z.ZodType<
  AiConfigsExperimentInfoRep,
  z.ZodTypeDef,
  unknown
> = z.object({
  baselineIdx: z.number().int(),
  items: z.array(AiConfigsLegacyExperimentRep$inboundSchema),
});
/** @internal */
export type AiConfigsExperimentInfoRep$Outbound = {
  baselineIdx: number;
  items: Array<AiConfigsLegacyExperimentRep$Outbound>;
};

/** @internal */
export const AiConfigsExperimentInfoRep$outboundSchema: z.ZodType<
  AiConfigsExperimentInfoRep$Outbound,
  z.ZodTypeDef,
  AiConfigsExperimentInfoRep
> = z.object({
  baselineIdx: z.number().int(),
  items: z.array(AiConfigsLegacyExperimentRep$outboundSchema),
});

export function aiConfigsExperimentInfoRepToJSON(
  aiConfigsExperimentInfoRep: AiConfigsExperimentInfoRep,
): string {
  return JSON.stringify(
    AiConfigsExperimentInfoRep$outboundSchema.parse(aiConfigsExperimentInfoRep),
  );
}
export function aiConfigsExperimentInfoRepFromJSON(
  jsonString: string,
): SafeParseResult<AiConfigsExperimentInfoRep, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => AiConfigsExperimentInfoRep$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'AiConfigsExperimentInfoRep' from JSON`,
  );
}
