/*
 * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
 */

import * as z from "zod/v3";
import { remap as remap$ } from "../../lib/primitives.js";

export type LibrariesDocumentsListV1Request = {
  libraryId: string;
  search?: string | null | undefined;
  pageSize?: number | undefined;
  page?: number | undefined;
  filtersAttributes?: string | null | undefined;
  sortBy?: string | undefined;
  sortOrder?: string | undefined;
};

/** @internal */
export type LibrariesDocumentsListV1Request$Outbound = {
  library_id: string;
  search?: string | null | undefined;
  page_size: number;
  page: number;
  filters_attributes?: string | null | undefined;
  sort_by: string;
  sort_order: string;
};

/** @internal */
export const LibrariesDocumentsListV1Request$outboundSchema: z.ZodType<
  LibrariesDocumentsListV1Request$Outbound,
  z.ZodTypeDef,
  LibrariesDocumentsListV1Request
> = z.object({
  libraryId: z.string(),
  search: z.nullable(z.string()).optional(),
  pageSize: z.number().int().default(100),
  page: z.number().int().default(0),
  filtersAttributes: z.nullable(z.string()).optional(),
  sortBy: z.string().default("created_at"),
  sortOrder: z.string().default("desc"),
}).transform((v) => {
  return remap$(v, {
    libraryId: "library_id",
    pageSize: "page_size",
    filtersAttributes: "filters_attributes",
    sortBy: "sort_by",
    sortOrder: "sort_order",
  });
});

export function librariesDocumentsListV1RequestToJSON(
  librariesDocumentsListV1Request: LibrariesDocumentsListV1Request,
): string {
  return JSON.stringify(
    LibrariesDocumentsListV1Request$outboundSchema.parse(
      librariesDocumentsListV1Request,
    ),
  );
}
