"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.ResponseBody$outboundSchema = exports.ResponseBody$inboundSchema = exports.CreateChunkStatus$outboundSchema = exports.CreateChunkStatus$inboundSchema = exports.CreateChunkKnowledgeMetadata$outboundSchema = exports.CreateChunkKnowledgeMetadata$inboundSchema = exports.CreateChunkRequest$outboundSchema = exports.CreateChunkRequest$inboundSchema = exports.RequestBody$outboundSchema = exports.RequestBody$inboundSchema = exports.CreateChunkMetadata$outboundSchema = exports.CreateChunkMetadata$inboundSchema = exports.CreateChunkStatus = void 0;
exports.createChunkMetadataToJSON = createChunkMetadataToJSON;
exports.createChunkMetadataFromJSON = createChunkMetadataFromJSON;
exports.requestBodyToJSON = requestBodyToJSON;
exports.requestBodyFromJSON = requestBodyFromJSON;
exports.createChunkRequestToJSON = createChunkRequestToJSON;
exports.createChunkRequestFromJSON = createChunkRequestFromJSON;
exports.createChunkKnowledgeMetadataToJSON = createChunkKnowledgeMetadataToJSON;
exports.createChunkKnowledgeMetadataFromJSON = createChunkKnowledgeMetadataFromJSON;
exports.responseBodyToJSON = responseBodyToJSON;
exports.responseBodyFromJSON = responseBodyFromJSON;
const z = __importStar(require("zod/v3"));
const primitives_js_1 = require("../../lib/primitives.js");
const schemas_js_1 = require("../../lib/schemas.js");
/**
 * The status of the chunk
 */
exports.CreateChunkStatus = {
    Pending: "pending",
    Processing: "processing",
    Completed: "completed",
    Failed: "failed",
    Queued: "queued",
};
/** @internal */
exports.CreateChunkMetadata$inboundSchema = z.union([z.string(), z.number(), z.boolean()]);
/** @internal */
exports.CreateChunkMetadata$outboundSchema = z.union([z.string(), z.number(), z.boolean()]);
function createChunkMetadataToJSON(createChunkMetadata) {
    return JSON.stringify(exports.CreateChunkMetadata$outboundSchema.parse(createChunkMetadata));
}
function createChunkMetadataFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.CreateChunkMetadata$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateChunkMetadata' from JSON`);
}
/** @internal */
exports.RequestBody$inboundSchema = z.object({
    text: z.string(),
    embedding: z.array(z.number()).optional(),
    metadata: z.record(z.union([z.string(), z.number(), z.boolean()])).optional(),
});
/** @internal */
exports.RequestBody$outboundSchema = z.object({
    text: z.string(),
    embedding: z.array(z.number()).optional(),
    metadata: z.record(z.union([z.string(), z.number(), z.boolean()])).optional(),
});
function requestBodyToJSON(requestBody) {
    return JSON.stringify(exports.RequestBody$outboundSchema.parse(requestBody));
}
function requestBodyFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.RequestBody$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'RequestBody' from JSON`);
}
/** @internal */
exports.CreateChunkRequest$inboundSchema = z.object({
    knowledge_id: z.string(),
    datasource_id: z.string(),
    RequestBody: z.array(z.lazy(() => exports.RequestBody$inboundSchema)).optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        "knowledge_id": "knowledgeId",
        "datasource_id": "datasourceId",
        "RequestBody": "requestBody",
    });
});
/** @internal */
exports.CreateChunkRequest$outboundSchema = z.object({
    knowledgeId: z.string(),
    datasourceId: z.string(),
    requestBody: z.array(z.lazy(() => exports.RequestBody$outboundSchema)).optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        knowledgeId: "knowledge_id",
        datasourceId: "datasource_id",
        requestBody: "RequestBody",
    });
});
function createChunkRequestToJSON(createChunkRequest) {
    return JSON.stringify(exports.CreateChunkRequest$outboundSchema.parse(createChunkRequest));
}
function createChunkRequestFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.CreateChunkRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateChunkRequest' from JSON`);
}
/** @internal */
exports.CreateChunkKnowledgeMetadata$inboundSchema = z.union([z.string(), z.number(), z.boolean()]);
/** @internal */
exports.CreateChunkKnowledgeMetadata$outboundSchema = z.union([z.string(), z.number(), z.boolean()]);
function createChunkKnowledgeMetadataToJSON(createChunkKnowledgeMetadata) {
    return JSON.stringify(exports.CreateChunkKnowledgeMetadata$outboundSchema.parse(createChunkKnowledgeMetadata));
}
function createChunkKnowledgeMetadataFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.CreateChunkKnowledgeMetadata$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateChunkKnowledgeMetadata' from JSON`);
}
/** @internal */
exports.CreateChunkStatus$inboundSchema = z.nativeEnum(exports.CreateChunkStatus);
/** @internal */
exports.CreateChunkStatus$outboundSchema = exports.CreateChunkStatus$inboundSchema;
/** @internal */
exports.ResponseBody$inboundSchema = z.object({
    _id: z.string(),
    text: z.string(),
    metadata: z.record(z.union([z.string(), z.number(), z.boolean()])).optional(),
    enabled: z.boolean(),
    status: exports.CreateChunkStatus$inboundSchema,
    created: z.string(),
    updated: z.string(),
    created_by_id: z.nullable(z.string()).optional(),
    update_by_id: z.nullable(z.string()).optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        "_id": "id",
        "created_by_id": "createdById",
        "update_by_id": "updateById",
    });
});
/** @internal */
exports.ResponseBody$outboundSchema = z.object({
    id: z.string(),
    text: z.string(),
    metadata: z.record(z.union([z.string(), z.number(), z.boolean()])).optional(),
    enabled: z.boolean(),
    status: exports.CreateChunkStatus$outboundSchema,
    created: z.string(),
    updated: z.string(),
    createdById: z.nullable(z.string()).optional(),
    updateById: z.nullable(z.string()).optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        id: "_id",
        createdById: "created_by_id",
        updateById: "update_by_id",
    });
});
function responseBodyToJSON(responseBody) {
    return JSON.stringify(exports.ResponseBody$outboundSchema.parse(responseBody));
}
function responseBodyFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.ResponseBody$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ResponseBody' from JSON`);
}
//# sourceMappingURL=createchunk.js.map