/*
 * 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 AiConfigsLink = {
  href?: string | undefined;
  type?: string | undefined;
};

/** @internal */
export const AiConfigsLink$inboundSchema: z.ZodType<
  AiConfigsLink,
  z.ZodTypeDef,
  unknown
> = z.object({
  href: z.string().optional(),
  type: z.string().optional(),
});
/** @internal */
export type AiConfigsLink$Outbound = {
  href?: string | undefined;
  type?: string | undefined;
};

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

export function aiConfigsLinkToJSON(aiConfigsLink: AiConfigsLink): string {
  return JSON.stringify(AiConfigsLink$outboundSchema.parse(aiConfigsLink));
}
export function aiConfigsLinkFromJSON(
  jsonString: string,
): SafeParseResult<AiConfigsLink, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => AiConfigsLink$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'AiConfigsLink' from JSON`,
  );
}
