/*
 * 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 {
  FTClassifierLossFunction,
  FTClassifierLossFunction$inboundSchema,
} from "./ftclassifierlossfunction.js";

export type ClassifierTargetOut = {
  name: string;
  labels: Array<string>;
  weight: number;
  lossFunction: FTClassifierLossFunction;
};

/** @internal */
export const ClassifierTargetOut$inboundSchema: z.ZodType<
  ClassifierTargetOut,
  z.ZodTypeDef,
  unknown
> = z.object({
  name: z.string(),
  labels: z.array(z.string()),
  weight: z.number(),
  loss_function: FTClassifierLossFunction$inboundSchema,
}).transform((v) => {
  return remap$(v, {
    "loss_function": "lossFunction",
  });
});

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