/*
 * 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 RelatedAIConfig = {
  key: string;
};

/** @internal */
export const RelatedAIConfig$inboundSchema: z.ZodType<
  RelatedAIConfig,
  z.ZodTypeDef,
  unknown
> = z.object({
  key: z.string(),
});
/** @internal */
export type RelatedAIConfig$Outbound = {
  key: string;
};

/** @internal */
export const RelatedAIConfig$outboundSchema: z.ZodType<
  RelatedAIConfig$Outbound,
  z.ZodTypeDef,
  RelatedAIConfig
> = z.object({
  key: z.string(),
});

export function relatedAIConfigToJSON(
  relatedAIConfig: RelatedAIConfig,
): string {
  return JSON.stringify(RelatedAIConfig$outboundSchema.parse(relatedAIConfig));
}
export function relatedAIConfigFromJSON(
  jsonString: string,
): SafeParseResult<RelatedAIConfig, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => RelatedAIConfig$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'RelatedAIConfig' from JSON`,
  );
}
