/*
 * 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 { ClosedEnum } from "../../types/enums.js";

export const WandbIntegrationType = {
  Wandb: "wandb",
} as const;
export type WandbIntegrationType = ClosedEnum<typeof WandbIntegrationType>;

export type WandbIntegration = {
  type?: WandbIntegrationType | 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 const WandbIntegrationType$outboundSchema: z.ZodNativeEnum<
  typeof WandbIntegrationType
> = z.nativeEnum(WandbIntegrationType);

/** @internal */
export type WandbIntegration$Outbound = {
  type: string;
  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: WandbIntegrationType$outboundSchema.default("wandb"),
  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),
  );
}
