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

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

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

/** @internal */
export const ClassifierTargetResult$inboundSchema: z.ZodType<
  ClassifierTargetResult,
  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 classifierTargetResultFromJSON(
  jsonString: string,
): SafeParseResult<ClassifierTargetResult, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => ClassifierTargetResult$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'ClassifierTargetResult' from JSON`,
  );
}
