/*
 * 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 JobMetadataOut = {
  expectedDurationSeconds?: number | null | undefined;
  cost?: number | null | undefined;
  costCurrency?: string | null | undefined;
  trainTokensPerStep?: number | null | undefined;
  trainTokens?: number | null | undefined;
  dataTokens?: number | null | undefined;
  estimatedStartTime?: number | null | undefined;
};

/** @internal */
export const JobMetadataOut$inboundSchema: z.ZodType<
  JobMetadataOut,
  z.ZodTypeDef,
  unknown
> = z.object({
  expected_duration_seconds: z.nullable(z.number().int()).optional(),
  cost: z.nullable(z.number()).optional(),
  cost_currency: z.nullable(z.string()).optional(),
  train_tokens_per_step: z.nullable(z.number().int()).optional(),
  train_tokens: z.nullable(z.number().int()).optional(),
  data_tokens: z.nullable(z.number().int()).optional(),
  estimated_start_time: z.nullable(z.number().int()).optional(),
}).transform((v) => {
  return remap$(v, {
    "expected_duration_seconds": "expectedDurationSeconds",
    "cost_currency": "costCurrency",
    "train_tokens_per_step": "trainTokensPerStep",
    "train_tokens": "trainTokens",
    "data_tokens": "dataTokens",
    "estimated_start_time": "estimatedStartTime",
  });
});

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