/*
 * 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 FilesApiRoutesListFilesRequest = {
  page?: number | undefined;
  pageSize?: number | undefined;
  includeTotal?: boolean | undefined;
  sampleType?: Array<components.SampleType> | null | undefined;
  source?: Array<components.Source> | null | undefined;
  search?: string | null | undefined;
  purpose?: components.FilePurpose | null | undefined;
  mimetypes?: Array<string> | null | undefined;
};

/** @internal */
export type FilesApiRoutesListFilesRequest$Outbound = {
  page: number;
  page_size: number;
  include_total: boolean;
  sample_type?: Array<string> | null | undefined;
  source?: Array<string> | null | undefined;
  search?: string | null | undefined;
  purpose?: string | null | undefined;
  mimetypes?: Array<string> | null | undefined;
};

/** @internal */
export const FilesApiRoutesListFilesRequest$outboundSchema: z.ZodType<
  FilesApiRoutesListFilesRequest$Outbound,
  z.ZodTypeDef,
  FilesApiRoutesListFilesRequest
> = z.object({
  page: z.number().int().default(0),
  pageSize: z.number().int().default(100),
  includeTotal: z.boolean().default(true),
  sampleType: z.nullable(z.array(components.SampleType$outboundSchema))
    .optional(),
  source: z.nullable(z.array(components.Source$outboundSchema)).optional(),
  search: z.nullable(z.string()).optional(),
  purpose: z.nullable(components.FilePurpose$outboundSchema).optional(),
  mimetypes: z.nullable(z.array(z.string())).optional(),
}).transform((v) => {
  return remap$(v, {
    pageSize: "page_size",
    includeTotal: "include_total",
    sampleType: "sample_type",
  });
});

export function filesApiRoutesListFilesRequestToJSON(
  filesApiRoutesListFilesRequest: FilesApiRoutesListFilesRequest,
): string {
  return JSON.stringify(
    FilesApiRoutesListFilesRequest$outboundSchema.parse(
      filesApiRoutesListFilesRequest,
    ),
  );
}
