/*
 * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
 * @generated-id: 355a0361c549
 */

import * as z from "zod/v4";
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";

/**
 * This is populated by Harmattan, but some fields have a name
 *
 * @remarks
 * that we don't want to expose in the API.
 */
export type ModelCapabilities = {
  completionChat: boolean;
  functionCalling: boolean;
  reasoning: boolean;
  completionFim: boolean;
  fineTuning: boolean;
  vision: boolean;
  ocr: boolean;
  classification: boolean;
  moderation: boolean;
  audio: boolean;
  audioTranscription: boolean;
  audioTranscriptionRealtime: boolean;
  audioSpeech: boolean;
};

/** @internal */
export const ModelCapabilities$inboundSchema: z.ZodType<
  ModelCapabilities,
  unknown
> = z.object({
  completion_chat: z.boolean().default(false),
  function_calling: z.boolean().default(false),
  reasoning: 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),
  audio_transcription_realtime: z.boolean().default(false),
  audio_speech: z.boolean().default(false),
}).transform((v) => {
  return remap$(v, {
    "completion_chat": "completionChat",
    "function_calling": "functionCalling",
    "completion_fim": "completionFim",
    "fine_tuning": "fineTuning",
    "audio_transcription": "audioTranscription",
    "audio_transcription_realtime": "audioTranscriptionRealtime",
    "audio_speech": "audioSpeech",
  });
});

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