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

export type ClassifierTargetIn = {
  name: string;
  labels: Array<string>;
  weight?: number | undefined;
  lossFunction?: FTClassifierLossFunction | null | undefined;
};

/** @internal */
export type ClassifierTargetIn$Outbound = {
  name: string;
  labels: Array<string>;
  weight: number;
  loss_function?: string | null | undefined;
};

/** @internal */
export const ClassifierTargetIn$outboundSchema: z.ZodType<
  ClassifierTargetIn$Outbound,
  z.ZodTypeDef,
  ClassifierTargetIn
> = z.object({
  name: z.string(),
  labels: z.array(z.string()),
  weight: z.number().default(1),
  lossFunction: z.nullable(FTClassifierLossFunction$outboundSchema).optional(),
}).transform((v) => {
  return remap$(v, {
    lossFunction: "loss_function",
  });
});

export function classifierTargetInToJSON(
  classifierTargetIn: ClassifierTargetIn,
): string {
  return JSON.stringify(
    ClassifierTargetIn$outboundSchema.parse(classifierTargetIn),
  );
}
