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

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

export type WandbIntegrationResult = {
  type: "wandb";
  /**
   * 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 WandbIntegrationResult$inboundSchema: z.ZodType<
  WandbIntegrationResult,
  unknown
> = z.object({
  type: z.literal("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 wandbIntegrationResultFromJSON(
  jsonString: string,
): SafeParseResult<WandbIntegrationResult, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => WandbIntegrationResult$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'WandbIntegrationResult' from JSON`,
  );
}
