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

import * as z from "zod/v4";
import { remap as remap$ } from "../../lib/primitives.js";
import { ApiEndpoint, ApiEndpoint$outboundSchema } from "./apiendpoint.js";
import {
  BatchRequest,
  BatchRequest$Outbound,
  BatchRequest$outboundSchema,
} from "./batchrequest.js";

export type CreateBatchJobRequest = {
  /**
   * A list of `.jsonl` files for batch inference.
   *
   * @remarks
   * Each line must be a JSON object with a `body` field containing the request payload:
   * ```json
   * {"custom_id": "0", "body": {"max_tokens": 100, "messages": [{"role": "user", "content": "What is the best French cheese?"}]}}
   * {"custom_id": "1", "body": {"max_tokens": 100, "messages": [{"role": "user", "content": "What is the best French wine?"}]}}
   * ```
   */
  inputFiles?: Array<string> | null | undefined;
  requests?: Array<BatchRequest> | null | undefined;
  endpoint: ApiEndpoint;
  /**
   * The model to be used for batch inference.
   */
  model?: string | null | undefined;
  /**
   * In case you want to use a specific agent from the **deprecated** agents api for batch inference, you can specify the agent ID here.
   */
  agentId?: string | null | undefined;
  /**
   * The metadata of your choice to be associated with the batch inference job.
   */
  metadata?: { [k: string]: string } | null | undefined;
  /**
   * The timeout in hours for the batch inference job.
   */
  timeoutHours?: number | undefined;
};

/** @internal */
export type CreateBatchJobRequest$Outbound = {
  input_files?: Array<string> | null | undefined;
  requests?: Array<BatchRequest$Outbound> | null | undefined;
  endpoint: string;
  model?: string | null | undefined;
  agent_id?: string | null | undefined;
  metadata?: { [k: string]: string } | null | undefined;
  timeout_hours: number;
};

/** @internal */
export const CreateBatchJobRequest$outboundSchema: z.ZodType<
  CreateBatchJobRequest$Outbound,
  CreateBatchJobRequest
> = z.object({
  inputFiles: z.nullable(z.array(z.string())).optional(),
  requests: z.nullable(z.array(BatchRequest$outboundSchema)).optional(),
  endpoint: ApiEndpoint$outboundSchema,
  model: z.nullable(z.string()).optional(),
  agentId: z.nullable(z.string()).optional(),
  metadata: z.nullable(z.record(z.string(), z.string())).optional(),
  timeoutHours: z.int().default(24),
}).transform((v) => {
  return remap$(v, {
    inputFiles: "input_files",
    agentId: "agent_id",
    timeoutHours: "timeout_hours",
  });
});

export function createBatchJobRequestToJSON(
  createBatchJobRequest: CreateBatchJobRequest,
): string {
  return JSON.stringify(
    CreateBatchJobRequest$outboundSchema.parse(createBatchJobRequest),
  );
}
