/*
 * 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";
import {
  ClassifierTargetOut,
  ClassifierTargetOut$inboundSchema,
} from "./classifiertargetout.js";
import {
  FTModelCapabilitiesOut,
  FTModelCapabilitiesOut$inboundSchema,
} from "./ftmodelcapabilitiesout.js";

export type ClassifierFTModelOut = {
  id: string;
  object?: "model" | undefined;
  created: number;
  ownedBy: string;
  workspaceId: string;
  root: string;
  rootVersion: string;
  archived: boolean;
  name?: string | null | undefined;
  description?: string | null | undefined;
  capabilities: FTModelCapabilitiesOut;
  maxContextLength: number | undefined;
  aliases?: Array<string> | undefined;
  job: string;
  classifierTargets: Array<ClassifierTargetOut>;
  modelType?: "classifier" | undefined;
};

/** @internal */
export const ClassifierFTModelOut$inboundSchema: z.ZodType<
  ClassifierFTModelOut,
  z.ZodTypeDef,
  unknown
> = z.object({
  id: z.string(),
  object: z.literal("model").default("model"),
  created: z.number().int(),
  owned_by: z.string(),
  workspace_id: z.string(),
  root: z.string(),
  root_version: z.string(),
  archived: z.boolean(),
  name: z.nullable(z.string()).optional(),
  description: z.nullable(z.string()).optional(),
  capabilities: FTModelCapabilitiesOut$inboundSchema,
  max_context_length: z.number().int().default(32768),
  aliases: z.array(z.string()).optional(),
  job: z.string(),
  classifier_targets: z.array(ClassifierTargetOut$inboundSchema),
  model_type: z.literal("classifier").default("classifier"),
}).transform((v) => {
  return remap$(v, {
    "owned_by": "ownedBy",
    "workspace_id": "workspaceId",
    "root_version": "rootVersion",
    "max_context_length": "maxContextLength",
    "classifier_targets": "classifierTargets",
    "model_type": "modelType",
  });
});

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