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

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 LegacyJobMetadata = {
  /**
   * The approximated time (in seconds) for the fine-tuning process to complete.
   */
  expectedDurationSeconds?: number | null | undefined;
  /**
   * The cost of the fine-tuning job.
   */
  cost?: number | null | undefined;
  /**
   * The currency used for the fine-tuning job cost.
   */
  costCurrency?: string | null | undefined;
  /**
   * The number of tokens consumed by one training step.
   */
  trainTokensPerStep?: number | null | undefined;
  /**
   * The total number of tokens used during the fine-tuning process.
   */
  trainTokens?: number | null | undefined;
  /**
   * The total number of tokens in the training dataset.
   */
  dataTokens?: number | null | undefined;
  estimatedStartTime?: number | null | undefined;
  deprecated: boolean;
  details: string;
  /**
   * The number of complete passes through the entire training dataset.
   */
  epochs?: number | null | undefined;
  /**
   * The number of training steps to perform. A training step refers to a single update of the model weights during the fine-tuning process. This update is typically calculated using a batch of samples from the training dataset.
   */
  trainingSteps?: number | null | undefined;
  object: "job.metadata";
};

/** @internal */
export const LegacyJobMetadata$inboundSchema: z.ZodType<
  LegacyJobMetadata,
  unknown
> = z.object({
  expected_duration_seconds: z.nullable(z.int()).optional(),
  cost: z.nullable(z.number()).optional(),
  cost_currency: z.nullable(z.string()).optional(),
  train_tokens_per_step: z.nullable(z.int()).optional(),
  train_tokens: z.nullable(z.int()).optional(),
  data_tokens: z.nullable(z.int()).optional(),
  estimated_start_time: z.nullable(z.int()).optional(),
  deprecated: z.boolean().default(true),
  details: z.string(),
  epochs: z.nullable(z.number()).optional(),
  training_steps: z.nullable(z.int()).optional(),
  object: z.literal("job.metadata").default("job.metadata"),
}).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",
    "training_steps": "trainingSteps",
  });
});

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