/*
 * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
 */

import * as z from "zod/v3";
import { remap as remap$ } from "../../lib/primitives.js";

export type WandbIntegration = {
  type?: "wandb" | undefined;
  /**
   * The name of the project that the new run will be created under.
   */
  project: string;
  /**
   * A display name to set for the run. If not set, will use the job ID as the name.
   */
  name?: string | null | undefined;
  /**
   * The WandB API key to use for authentication.
   */
  apiKey: string;
  runName?: string | null | undefined;
};

/** @internal */
export type WandbIntegration$Outbound = {
  type: "wandb";
  project: string;
  name?: string | null | undefined;
  api_key: string;
  run_name?: string | null | undefined;
};

/** @internal */
export const WandbIntegration$outboundSchema: z.ZodType<
  WandbIntegration$Outbound,
  z.ZodTypeDef,
  WandbIntegration
> = z.object({
  type: z.literal("wandb").default("wandb" as const),
  project: z.string(),
  name: z.nullable(z.string()).optional(),
  apiKey: z.string(),
  runName: z.nullable(z.string()).optional(),
}).transform((v) => {
  return remap$(v, {
    apiKey: "api_key",
    runName: "run_name",
  });
});

export function wandbIntegrationToJSON(
  wandbIntegration: WandbIntegration,
): string {
  return JSON.stringify(
    WandbIntegration$outboundSchema.parse(wandbIntegration),
  );
}
