"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.ListChunksResponseBody$outboundSchema = exports.ListChunksResponseBody$inboundSchema = exports.ListChunksData$outboundSchema = exports.ListChunksData$inboundSchema = exports.ListChunksStatus$outboundSchema = exports.ListChunksStatus$inboundSchema = exports.ListChunksMetadata$outboundSchema = exports.ListChunksMetadata$inboundSchema = exports.ListChunksObject$outboundSchema = exports.ListChunksObject$inboundSchema = exports.ListChunksRequest$outboundSchema = exports.ListChunksRequest$inboundSchema = exports.QueryParamStatus$outboundSchema = exports.QueryParamStatus$inboundSchema = exports.ListChunksStatus = exports.ListChunksObject = void 0;
exports.queryParamStatusToJSON = queryParamStatusToJSON;
exports.queryParamStatusFromJSON = queryParamStatusFromJSON;
exports.listChunksRequestToJSON = listChunksRequestToJSON;
exports.listChunksRequestFromJSON = listChunksRequestFromJSON;
exports.listChunksMetadataToJSON = listChunksMetadataToJSON;
exports.listChunksMetadataFromJSON = listChunksMetadataFromJSON;
exports.listChunksDataToJSON = listChunksDataToJSON;
exports.listChunksDataFromJSON = listChunksDataFromJSON;
exports.listChunksResponseBodyToJSON = listChunksResponseBodyToJSON;
exports.listChunksResponseBodyFromJSON = listChunksResponseBodyFromJSON;
const z = __importStar(require("zod/v3"));
const primitives_js_1 = require("../../lib/primitives.js");
const schemas_js_1 = require("../../lib/schemas.js");
exports.ListChunksObject = {
    List: "list",
};
/**
 * The status of the chunk
 */
exports.ListChunksStatus = {
    Pending: "pending",
    Processing: "processing",
    Completed: "completed",
    Failed: "failed",
    Queued: "queued",
};
/** @internal */
exports.QueryParamStatus$inboundSchema = z.union([z.array(z.string()), z.string()]);
/** @internal */
exports.QueryParamStatus$outboundSchema = z.union([z.array(z.string()), z.string()]);
function queryParamStatusToJSON(queryParamStatus) {
    return JSON.stringify(exports.QueryParamStatus$outboundSchema.parse(queryParamStatus));
}
function queryParamStatusFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.QueryParamStatus$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'QueryParamStatus' from JSON`);
}
/** @internal */
exports.ListChunksRequest$inboundSchema = z.object({
    knowledge_id: z.string(),
    datasource_id: z.string(),
    limit: z.number().default(10),
    starting_after: z.string().optional(),
    ending_before: z.string().optional(),
    q: z.string().optional(),
    status: z.union([z.array(z.string()), z.string()]).optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        "knowledge_id": "knowledgeId",
        "datasource_id": "datasourceId",
        "starting_after": "startingAfter",
        "ending_before": "endingBefore",
    });
});
/** @internal */
exports.ListChunksRequest$outboundSchema = z.object({
    knowledgeId: z.string(),
    datasourceId: z.string(),
    limit: z.number().default(10),
    startingAfter: z.string().optional(),
    endingBefore: z.string().optional(),
    q: z.string().optional(),
    status: z.union([z.array(z.string()), z.string()]).optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        knowledgeId: "knowledge_id",
        datasourceId: "datasource_id",
        startingAfter: "starting_after",
        endingBefore: "ending_before",
    });
});
function listChunksRequestToJSON(listChunksRequest) {
    return JSON.stringify(exports.ListChunksRequest$outboundSchema.parse(listChunksRequest));
}
function listChunksRequestFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.ListChunksRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ListChunksRequest' from JSON`);
}
/** @internal */
exports.ListChunksObject$inboundSchema = z.nativeEnum(exports.ListChunksObject);
/** @internal */
exports.ListChunksObject$outboundSchema = exports.ListChunksObject$inboundSchema;
/** @internal */
exports.ListChunksMetadata$inboundSchema = z.union([z.string(), z.number(), z.boolean()]);
/** @internal */
exports.ListChunksMetadata$outboundSchema = z.union([z.string(), z.number(), z.boolean()]);
function listChunksMetadataToJSON(listChunksMetadata) {
    return JSON.stringify(exports.ListChunksMetadata$outboundSchema.parse(listChunksMetadata));
}
function listChunksMetadataFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.ListChunksMetadata$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ListChunksMetadata' from JSON`);
}
/** @internal */
exports.ListChunksStatus$inboundSchema = z.nativeEnum(exports.ListChunksStatus);
/** @internal */
exports.ListChunksStatus$outboundSchema = exports.ListChunksStatus$inboundSchema;
/** @internal */
exports.ListChunksData$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.ListChunksStatus$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.ListChunksData$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.ListChunksStatus$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 listChunksDataToJSON(listChunksData) {
    return JSON.stringify(exports.ListChunksData$outboundSchema.parse(listChunksData));
}
function listChunksDataFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.ListChunksData$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ListChunksData' from JSON`);
}
/** @internal */
exports.ListChunksResponseBody$inboundSchema = z.object({
    object: exports.ListChunksObject$inboundSchema,
    data: z.array(z.lazy(() => exports.ListChunksData$inboundSchema)),
    has_more: z.boolean(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        "has_more": "hasMore",
    });
});
/** @internal */
exports.ListChunksResponseBody$outboundSchema = z.object({
    object: exports.ListChunksObject$outboundSchema,
    data: z.array(z.lazy(() => exports.ListChunksData$outboundSchema)),
    hasMore: z.boolean(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        hasMore: "has_more",
    });
});
function listChunksResponseBodyToJSON(listChunksResponseBody) {
    return JSON.stringify(exports.ListChunksResponseBody$outboundSchema.parse(listChunksResponseBody));
}
function listChunksResponseBodyFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.ListChunksResponseBody$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ListChunksResponseBody' from JSON`);
}
//# sourceMappingURL=listchunks.js.map