/*
 * 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";

export type WandbIntegrationOut = {
  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;
  runName?: string | null | undefined;
  url?: string | null | undefined;
};

/** @internal */
export const WandbIntegrationOut$inboundSchema: z.ZodType<
  WandbIntegrationOut,
  z.ZodTypeDef,
  unknown
> = z.object({
  type: z.literal("wandb").default("wandb"),
  project: z.string(),
  name: z.nullable(z.string()).optional(),
  run_name: z.nullable(z.string()).optional(),
  url: z.nullable(z.string()).optional(),
}).transform((v) => {
  return remap$(v, {
    "run_name": "runName",
  });
});

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