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

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

export type ModelCapabilities = {
  completionChat: boolean | undefined;
  functionCalling: boolean | undefined;
  completionFim: boolean | undefined;
  fineTuning: boolean | undefined;
  vision: boolean | undefined;
  ocr: boolean | undefined;
  classification: boolean | undefined;
  moderation: boolean | undefined;
  audio: boolean | undefined;
  audioTranscription: boolean | undefined;
};

/** @internal */
export const ModelCapabilities$inboundSchema: z.ZodType<
  ModelCapabilities,
  z.ZodTypeDef,
  unknown
> = z.object({
  completion_chat: z.boolean().default(false),
  function_calling: z.boolean().default(false),
  completion_fim: z.boolean().default(false),
  fine_tuning: z.boolean().default(false),
  vision: z.boolean().default(false),
  ocr: z.boolean().default(false),
  classification: z.boolean().default(false),
  moderation: z.boolean().default(false),
  audio: z.boolean().default(false),
  audio_transcription: z.boolean().default(false),
}).transform((v) => {
  return remap$(v, {
    "completion_chat": "completionChat",
    "function_calling": "functionCalling",
    "completion_fim": "completionFim",
    "fine_tuning": "fineTuning",
    "audio_transcription": "audioTranscription",
  });
});

export function modelCapabilitiesFromJSON(
  jsonString: string,
): SafeParseResult<ModelCapabilities, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => ModelCapabilities$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'ModelCapabilities' from JSON`,
  );
}
