"use strict";
/*
 * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
 */
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    var desc = Object.getOwnPropertyDescriptor(m, k);
    if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
      desc = { enumerable: true, get: function() { return m[k]; } };
    }
    Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
    Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
    o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
    var ownKeys = function(o) {
        ownKeys = Object.getOwnPropertyNames || function (o) {
            var ar = [];
            for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
            return ar;
        };
        return ownKeys(o);
    };
    return function (mod) {
        if (mod && mod.__esModule) return mod;
        var result = {};
        if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
        __setModuleDefault(result, mod);
        return result;
    };
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.FileUploadResponseBody$outboundSchema = exports.FileUploadResponseBody$inboundSchema = exports.FileUploadPurpose$outboundSchema = exports.FileUploadPurpose$inboundSchema = exports.FileUploadRequestBody$outboundSchema = exports.FileUploadRequestBody$inboundSchema = exports.Purpose$outboundSchema = exports.Purpose$inboundSchema = exports.FileUploadFile$outboundSchema = exports.FileUploadFile$inboundSchema = exports.FileUploadPurpose = exports.Purpose = void 0;
exports.fileUploadFileToJSON = fileUploadFileToJSON;
exports.fileUploadFileFromJSON = fileUploadFileFromJSON;
exports.fileUploadRequestBodyToJSON = fileUploadRequestBodyToJSON;
exports.fileUploadRequestBodyFromJSON = fileUploadRequestBodyFromJSON;
exports.fileUploadResponseBodyToJSON = fileUploadResponseBodyToJSON;
exports.fileUploadResponseBodyFromJSON = fileUploadResponseBodyFromJSON;
const z = __importStar(require("zod/v3"));
const primitives_js_1 = require("../../lib/primitives.js");
const schemas_js_1 = require("../../lib/schemas.js");
const blobs_js_1 = require("../../types/blobs.js");
/**
 * The intended purpose of the uploaded file.
 */
exports.Purpose = {
    Retrieval: "retrieval",
    KnowledgeDatasource: "knowledge_datasource",
    Batch: "batch",
};
/**
 * The intended purpose of the uploaded file.
 */
exports.FileUploadPurpose = {
    Retrieval: "retrieval",
    KnowledgeDatasource: "knowledge_datasource",
    Batch: "batch",
};
/** @internal */
exports.FileUploadFile$inboundSchema = z.object({
    fileName: z.string(),
    content: z.union([
        z.instanceof((ReadableStream)),
        z.instanceof(Blob),
        z.instanceof(ArrayBuffer),
        z.instanceof(Uint8Array),
    ]),
});
/** @internal */
exports.FileUploadFile$outboundSchema = z.object({
    fileName: z.string(),
    content: z.union([
        z.instanceof((ReadableStream)),
        z.instanceof(Blob),
        z.instanceof(ArrayBuffer),
        z.instanceof(Uint8Array),
    ]),
});
function fileUploadFileToJSON(fileUploadFile) {
    return JSON.stringify(exports.FileUploadFile$outboundSchema.parse(fileUploadFile));
}
function fileUploadFileFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.FileUploadFile$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'FileUploadFile' from JSON`);
}
/** @internal */
exports.Purpose$inboundSchema = z
    .nativeEnum(exports.Purpose);
/** @internal */
exports.Purpose$outboundSchema = exports.Purpose$inboundSchema;
/** @internal */
exports.FileUploadRequestBody$inboundSchema = z.object({
    file: z.lazy(() => exports.FileUploadFile$inboundSchema),
    purpose: exports.Purpose$inboundSchema.default("retrieval"),
});
/** @internal */
exports.FileUploadRequestBody$outboundSchema = z.object({
    file: z.lazy(() => exports.FileUploadFile$outboundSchema).or(blobs_js_1.blobLikeSchema),
    purpose: exports.Purpose$outboundSchema.default("retrieval"),
});
function fileUploadRequestBodyToJSON(fileUploadRequestBody) {
    return JSON.stringify(exports.FileUploadRequestBody$outboundSchema.parse(fileUploadRequestBody));
}
function fileUploadRequestBodyFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.FileUploadRequestBody$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'FileUploadRequestBody' from JSON`);
}
/** @internal */
exports.FileUploadPurpose$inboundSchema = z.nativeEnum(exports.FileUploadPurpose);
/** @internal */
exports.FileUploadPurpose$outboundSchema = exports.FileUploadPurpose$inboundSchema;
/** @internal */
exports.FileUploadResponseBody$inboundSchema = z.object({
    _id: z.string(),
    object_name: z.string(),
    purpose: exports.FileUploadPurpose$inboundSchema,
    bytes: z.number(),
    file_name: z.string(),
    workspace_id: z.string(),
    created: z.string().datetime({ offset: true }).default("2025-11-25T16:24:26.415Z").transform(v => new Date(v)),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        "_id": "id",
        "object_name": "objectName",
        "file_name": "fileName",
        "workspace_id": "workspaceId",
    });
});
/** @internal */
exports.FileUploadResponseBody$outboundSchema = z.object({
    id: z.string(),
    objectName: z.string(),
    purpose: exports.FileUploadPurpose$outboundSchema,
    bytes: z.number(),
    fileName: z.string(),
    workspaceId: z.string(),
    created: z.date().default(() => new Date("2025-11-25T16:24:26.415Z"))
        .transform(v => v.toISOString()),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        id: "_id",
        objectName: "object_name",
        fileName: "file_name",
        workspaceId: "workspace_id",
    });
});
function fileUploadResponseBodyToJSON(fileUploadResponseBody) {
    return JSON.stringify(exports.FileUploadResponseBody$outboundSchema.parse(fileUploadResponseBody));
}
function fileUploadResponseBodyFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.FileUploadResponseBody$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'FileUploadResponseBody' from JSON`);
}
//# sourceMappingURL=fileupload.js.map