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

import * as z from "zod/v4";
import { remap as remap$ } from "../../lib/primitives.js";
import { ClosedEnum } from "../../types/enums.js";
import * as components from "../components/index.js";

export const OrderBy = {
  Created: "created",
  MinusCreated: "-created",
} as const;
export type OrderBy = ClosedEnum<typeof OrderBy>;

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;
  orderBy?: OrderBy | undefined;
};

/** @internal */
export const OrderBy$outboundSchema: z.ZodEnum<typeof OrderBy> = z.enum(
  OrderBy,
);

/** @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;
  order_by: string;
};

/** @internal */
export const JobsApiRoutesBatchGetBatchJobsRequest$outboundSchema: z.ZodType<
  JobsApiRoutesBatchGetBatchJobsRequest$Outbound,
  JobsApiRoutesBatchGetBatchJobsRequest
> = z.object({
  page: z.int().default(0),
  pageSize: z.int().default(100),
  model: z.nullable(z.string()).optional(),
  agentId: z.nullable(z.string()).optional(),
  metadata: z.nullable(z.record(z.string(), 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(),
  orderBy: OrderBy$outboundSchema.default("-created"),
}).transform((v) => {
  return remap$(v, {
    pageSize: "page_size",
    agentId: "agent_id",
    createdAfter: "created_after",
    createdByMe: "created_by_me",
    orderBy: "order_by",
  });
});

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