/*
 * 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 { ClosedEnum } from "../../types/enums.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 const ClassifierFTModelOutObject = {
  Model: "model",
} as const;
export type ClassifierFTModelOutObject = ClosedEnum<
  typeof ClassifierFTModelOutObject
>;

export const ClassifierFTModelOutModelType = {
  Classifier: "classifier",
} as const;
export type ClassifierFTModelOutModelType = ClosedEnum<
  typeof ClassifierFTModelOutModelType
>;

export type ClassifierFTModelOut = {
  id: string;
  object: ClassifierFTModelOutObject | 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: ClassifierFTModelOutModelType | undefined;
};

/** @internal */
export const ClassifierFTModelOutObject$inboundSchema: z.ZodNativeEnum<
  typeof ClassifierFTModelOutObject
> = z.nativeEnum(ClassifierFTModelOutObject);

/** @internal */
export const ClassifierFTModelOutModelType$inboundSchema: z.ZodNativeEnum<
  typeof ClassifierFTModelOutModelType
> = z.nativeEnum(ClassifierFTModelOutModelType);

/** @internal */
export const ClassifierFTModelOut$inboundSchema: z.ZodType<
  ClassifierFTModelOut,
  z.ZodTypeDef,
  unknown
> = z.object({
  id: z.string(),
  object: ClassifierFTModelOutObject$inboundSchema.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: ClassifierFTModelOutModelType$inboundSchema.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`,
  );
}
