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

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

export type LibrariesDocumentsListV1Request = {
  libraryId: string;
  search?: string | null | undefined;
  pageSize?: number | undefined;
  page?: number | undefined;
  /**
   * Deprecated: this parameter will be removed in a future version.
   *
   * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible.
   */
  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,
  LibrariesDocumentsListV1Request
> = z.object({
  libraryId: z.string(),
  search: z.nullable(z.string()).optional(),
  pageSize: z.int().default(100),
  page: z.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,
    ),
  );
}
