/*
 * 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 * as components from "../components/index.js";

export type JobsApiRoutesBatchGetBatchJobsRequest = {
  page?: number | undefined;
  pageSize?: number | undefined;
  model?: string | null | undefined;
  agentId?: string | null | undefined;
  metadata?: { [k: string]: any } | null | undefined;
  createdAfter?: Date | null | undefined;
  createdByMe?: boolean | undefined;
  status?: Array<components.BatchJobStatus> | null | undefined;
};

/** @internal */
export type JobsApiRoutesBatchGetBatchJobsRequest$Outbound = {
  page: number;
  page_size: number;
  model?: string | null | undefined;
  agent_id?: string | null | undefined;
  metadata?: { [k: string]: any } | null | undefined;
  created_after?: string | null | undefined;
  created_by_me: boolean;
  status?: Array<string> | null | undefined;
};

/** @internal */
export const JobsApiRoutesBatchGetBatchJobsRequest$outboundSchema: z.ZodType<
  JobsApiRoutesBatchGetBatchJobsRequest$Outbound,
  z.ZodTypeDef,
  JobsApiRoutesBatchGetBatchJobsRequest
> = z.object({
  page: z.number().int().default(0),
  pageSize: z.number().int().default(100),
  model: z.nullable(z.string()).optional(),
  agentId: z.nullable(z.string()).optional(),
  metadata: z.nullable(z.record(z.any())).optional(),
  createdAfter: z.nullable(z.date().transform(v => v.toISOString())).optional(),
  createdByMe: z.boolean().default(false),
  status: z.nullable(z.array(components.BatchJobStatus$outboundSchema))
    .optional(),
}).transform((v) => {
  return remap$(v, {
    pageSize: "page_size",
    agentId: "agent_id",
    createdAfter: "created_after",
    createdByMe: "created_by_me",
  });
});

export function jobsApiRoutesBatchGetBatchJobsRequestToJSON(
  jobsApiRoutesBatchGetBatchJobsRequest: JobsApiRoutesBatchGetBatchJobsRequest,
): string {
  return JSON.stringify(
    JobsApiRoutesBatchGetBatchJobsRequest$outboundSchema.parse(
      jobsApiRoutesBatchGetBatchJobsRequest,
    ),
  );
}
