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

import * as z from "zod/v3";
import { blobLikeSchema } from "../../types/blobs.js";
import * as components from "../components/index.js";

export type FilesApiRoutesUploadFileMultiPartBodyParams = {
  purpose?: components.FilePurpose | undefined;
  /**
   * The File object (not file name) to be uploaded.
   *
   * @remarks
   *  To upload a file and specify a custom file name you should format your request as such:
   *  ```bash
   *  file=@path/to/your/file.jsonl;filename=custom_name.jsonl
   *  ```
   *  Otherwise, you can just keep the original file name:
   *  ```bash
   *  file=@path/to/your/file.jsonl
   *  ```
   */
  file: components.FileT | Blob;
};

/** @internal */
export type FilesApiRoutesUploadFileMultiPartBodyParams$Outbound = {
  purpose?: string | undefined;
  file: components.FileT$Outbound | Blob;
};

/** @internal */
export const FilesApiRoutesUploadFileMultiPartBodyParams$outboundSchema:
  z.ZodType<
    FilesApiRoutesUploadFileMultiPartBodyParams$Outbound,
    z.ZodTypeDef,
    FilesApiRoutesUploadFileMultiPartBodyParams
  > = z.object({
    purpose: components.FilePurpose$outboundSchema.optional(),
    file: components.FileT$outboundSchema.or(blobLikeSchema),
  });

export function filesApiRoutesUploadFileMultiPartBodyParamsToJSON(
  filesApiRoutesUploadFileMultiPartBodyParams:
    FilesApiRoutesUploadFileMultiPartBodyParams,
): string {
  return JSON.stringify(
    FilesApiRoutesUploadFileMultiPartBodyParams$outboundSchema.parse(
      filesApiRoutesUploadFileMultiPartBodyParams,
    ),
  );
}
