/**
 * Cloudflare VECTORIZE API
 *
 * Generated from Cloudflare TypeScript SDK.
 * DO NOT EDIT - regenerate with: bun scripts/generate.ts --service vectorize
 */
import * as Schema from "effect/Schema";
import * as API from "../client/api.js";
import * as T from "../traits.js";
import {} from "../errors.js";
import { UploadableSchema } from "../schemas.js";
export const GetByIdsIndexRequest = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    indexName: Schema.String.pipe(T.HttpPath("indexName")),
    accountId: Schema.String.pipe(T.HttpPath("account_id")),
    ids: Schema.optional(Schema.Array(Schema.String)),
}).pipe(T.Http({
    method: "POST",
    path: "/accounts/{account_id}/vectorize/v2/indexes/{indexName}/get_by_ids",
}));
export const GetByIdsIndexResponse = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Unknown.pipe(T.ResponsePath("result"));
export const getByIdsIndex = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: GetByIdsIndexRequest,
    output: GetByIdsIndexResponse,
    errors: [],
}));
export const DeleteByIdsIndexRequest = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    indexName: Schema.String.pipe(T.HttpPath("indexName")),
    accountId: Schema.String.pipe(T.HttpPath("account_id")),
    ids: Schema.optional(Schema.Array(Schema.String)),
}).pipe(T.Http({
    method: "POST",
    path: "/accounts/{account_id}/vectorize/v2/indexes/{indexName}/delete_by_ids",
}));
export const DeleteByIdsIndexResponse = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    mutationId: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
}).pipe(T.ResponsePath("result"));
export const deleteByIdsIndex = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: DeleteByIdsIndexRequest,
    output: DeleteByIdsIndexResponse,
    errors: [],
}));
export const GetIndexRequest = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    indexName: Schema.String.pipe(T.HttpPath("indexName")),
    accountId: Schema.String.pipe(T.HttpPath("account_id")),
}).pipe(T.Http({
    method: "GET",
    path: "/accounts/{account_id}/vectorize/v2/indexes/{indexName}",
}));
export const GetIndexResponse = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    config: Schema.optional(Schema.Union([
        Schema.Struct({
            dimensions: Schema.Number,
            metric: Schema.Literals(["cosine", "euclidean", "dot-product"]),
        }),
        Schema.Null,
    ])),
    createdOn: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
    description: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
    modifiedOn: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
    name: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
})
    .pipe(Schema.encodeKeys({
    config: "config",
    createdOn: "created_on",
    description: "description",
    modifiedOn: "modified_on",
    name: "name",
}))
    .pipe(T.ResponsePath("result"));
export const getIndex = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: GetIndexRequest,
    output: GetIndexResponse,
    errors: [],
}));
export const ListIndexesRequest = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    accountId: Schema.String.pipe(T.HttpPath("account_id")),
}).pipe(T.Http({
    method: "GET",
    path: "/accounts/{account_id}/vectorize/v2/indexes",
}));
export const ListIndexesResponse = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    result: Schema.Array(Schema.Struct({
        config: Schema.optional(Schema.Union([
            Schema.Struct({
                dimensions: Schema.Number,
                metric: Schema.Literals(["cosine", "euclidean", "dot-product"]),
            }),
            Schema.Null,
        ])),
        createdOn: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
        description: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
        modifiedOn: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
        name: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
    }).pipe(Schema.encodeKeys({
        config: "config",
        createdOn: "created_on",
        description: "description",
        modifiedOn: "modified_on",
        name: "name",
    }))),
});
export const listIndexes = /*@__PURE__*/ /*#__PURE__*/ API.makePaginated(() => ({
    input: ListIndexesRequest,
    output: ListIndexesResponse,
    errors: [],
    pagination: {
        mode: "single",
        items: "result",
    },
}));
export const CreateIndexRequest = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    accountId: Schema.String.pipe(T.HttpPath("account_id")),
    config: Schema.Union([
        Schema.Struct({
            dimensions: Schema.Number,
            metric: Schema.Literals(["cosine", "euclidean", "dot-product"]),
        }),
        Schema.Struct({
            preset: Schema.Literals([
                "@cf/baai/bge-small-en-v1.5",
                "@cf/baai/bge-base-en-v1.5",
                "@cf/baai/bge-large-en-v1.5",
                "openai/text-embedding-ada-002",
                "cohere/embed-multilingual-v2.0",
            ]),
        }),
    ]),
    name: Schema.String,
    description: Schema.optional(Schema.String),
}).pipe(T.Http({
    method: "POST",
    path: "/accounts/{account_id}/vectorize/v2/indexes",
}));
export const CreateIndexResponse = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    config: Schema.optional(Schema.Union([
        Schema.Struct({
            dimensions: Schema.Number,
            metric: Schema.Literals(["cosine", "euclidean", "dot-product"]),
        }),
        Schema.Null,
    ])),
    createdOn: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
    description: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
    modifiedOn: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
    name: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
})
    .pipe(Schema.encodeKeys({
    config: "config",
    createdOn: "created_on",
    description: "description",
    modifiedOn: "modified_on",
    name: "name",
}))
    .pipe(T.ResponsePath("result"));
export const createIndex = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: CreateIndexRequest,
    output: CreateIndexResponse,
    errors: [],
}));
export const DeleteIndexRequest = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    indexName: Schema.String.pipe(T.HttpPath("indexName")),
    accountId: Schema.String.pipe(T.HttpPath("account_id")),
}).pipe(T.Http({
    method: "DELETE",
    path: "/accounts/{account_id}/vectorize/v2/indexes/{indexName}",
}));
export const DeleteIndexResponse = 
/*@__PURE__*/ /*#__PURE__*/ Schema.String.pipe(T.ResponsePath("result"));
export const deleteIndex = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: DeleteIndexRequest,
    output: DeleteIndexResponse,
    errors: [],
}));
export const InfoIndexRequest = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    indexName: Schema.String.pipe(T.HttpPath("indexName")),
    accountId: Schema.String.pipe(T.HttpPath("account_id")),
}).pipe(T.Http({
    method: "GET",
    path: "/accounts/{account_id}/vectorize/v2/indexes/{indexName}/info",
}));
export const InfoIndexResponse = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    dimensions: Schema.optional(Schema.Union([Schema.Number, Schema.Null])),
    processedUpToDatetime: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
    processedUpToMutation: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
    vectorCount: Schema.optional(Schema.Union([Schema.Number, Schema.Null])),
}).pipe(T.ResponsePath("result"));
export const infoIndex = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: InfoIndexRequest,
    output: InfoIndexResponse,
    errors: [],
}));
export const InsertIndexRequest = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    indexName: Schema.String.pipe(T.HttpPath("indexName")),
    accountId: Schema.String.pipe(T.HttpPath("account_id")),
    unparsableBehavior: Schema.optional(Schema.Literals(["error", "discard"])).pipe(T.HttpQuery("unparsable-behavior")),
    body: UploadableSchema.pipe(T.HttpFormDataFile()).pipe(T.HttpBody()),
}).pipe(T.Http({
    method: "POST",
    path: "/accounts/{account_id}/vectorize/v2/indexes/{indexName}/insert",
    contentType: "multipart",
}));
export const InsertIndexResponse = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    mutationId: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
}).pipe(T.ResponsePath("result"));
export const insertIndex = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: InsertIndexRequest,
    output: InsertIndexResponse,
    errors: [],
}));
export const QueryIndexRequest = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    indexName: Schema.String.pipe(T.HttpPath("indexName")),
    accountId: Schema.String.pipe(T.HttpPath("account_id")),
    vector: Schema.Array(Schema.Number),
    filter: Schema.optional(Schema.Unknown),
    returnMetadata: Schema.optional(Schema.Literals(["none", "indexed", "all"])),
    returnValues: Schema.optional(Schema.Boolean),
    topK: Schema.optional(Schema.Number),
}).pipe(T.Http({
    method: "POST",
    path: "/accounts/{account_id}/vectorize/v2/indexes/{indexName}/query",
}));
export const QueryIndexResponse = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    count: Schema.optional(Schema.Union([Schema.Number, Schema.Null])),
    matches: Schema.optional(Schema.Union([
        Schema.Array(Schema.Struct({
            id: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
            metadata: Schema.optional(Schema.Null),
            namespace: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
            score: Schema.optional(Schema.Union([Schema.Number, Schema.Null])),
            values: Schema.optional(Schema.Union([Schema.Array(Schema.Number), Schema.Null])),
        })),
        Schema.Null,
    ])),
}).pipe(T.ResponsePath("result"));
export const queryIndex = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: QueryIndexRequest,
    output: QueryIndexResponse,
    errors: [],
}));
export const UpsertIndexRequest = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    indexName: Schema.String.pipe(T.HttpPath("indexName")),
    accountId: Schema.String.pipe(T.HttpPath("account_id")),
    unparsableBehavior: Schema.optional(Schema.Literals(["error", "discard"])).pipe(T.HttpQuery("unparsable-behavior")),
    body: UploadableSchema.pipe(T.HttpFormDataFile()).pipe(T.HttpBody()),
}).pipe(T.Http({
    method: "POST",
    path: "/accounts/{account_id}/vectorize/v2/indexes/{indexName}/upsert",
    contentType: "multipart",
}));
export const UpsertIndexResponse = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    mutationId: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
}).pipe(T.ResponsePath("result"));
export const upsertIndex = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: UpsertIndexRequest,
    output: UpsertIndexResponse,
    errors: [],
}));
export const ListIndexMetadataIndexesRequest = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    indexName: Schema.String.pipe(T.HttpPath("indexName")),
    accountId: Schema.String.pipe(T.HttpPath("account_id")),
}).pipe(T.Http({
    method: "GET",
    path: "/accounts/{account_id}/vectorize/v2/indexes/{indexName}/metadata_index/list",
}));
export const ListIndexMetadataIndexesResponse = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    metadataIndexes: Schema.optional(Schema.Union([
        Schema.Array(Schema.Struct({
            indexType: Schema.optional(Schema.Union([
                Schema.Literals(["string", "number", "boolean"]),
                Schema.Null,
            ])),
            propertyName: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
        })),
        Schema.Null,
    ])),
}).pipe(T.ResponsePath("result"));
export const listIndexMetadataIndexes = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: ListIndexMetadataIndexesRequest,
    output: ListIndexMetadataIndexesResponse,
    errors: [],
}));
export const CreateIndexMetadataIndexRequest = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    indexName: Schema.String.pipe(T.HttpPath("indexName")),
    accountId: Schema.String.pipe(T.HttpPath("account_id")),
    indexType: Schema.Literals(["string", "number", "boolean"]),
    propertyName: Schema.String,
}).pipe(T.Http({
    method: "POST",
    path: "/accounts/{account_id}/vectorize/v2/indexes/{indexName}/metadata_index/create",
}));
export const CreateIndexMetadataIndexResponse = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    mutationId: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
}).pipe(T.ResponsePath("result"));
export const createIndexMetadataIndex = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: CreateIndexMetadataIndexRequest,
    output: CreateIndexMetadataIndexResponse,
    errors: [],
}));
export const DeleteIndexMetadataIndexRequest = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    indexName: Schema.String.pipe(T.HttpPath("indexName")),
    accountId: Schema.String.pipe(T.HttpPath("account_id")),
    propertyName: Schema.String,
}).pipe(T.Http({
    method: "POST",
    path: "/accounts/{account_id}/vectorize/v2/indexes/{indexName}/metadata_index/delete",
}));
export const DeleteIndexMetadataIndexResponse = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    mutationId: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
}).pipe(T.ResponsePath("result"));
export const deleteIndexMetadataIndex = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: DeleteIndexMetadataIndexRequest,
    output: DeleteIndexMetadataIndexResponse,
    errors: [],
}));
export const ListVectorsIndexRequest = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    indexName: Schema.String.pipe(T.HttpPath("indexName")),
    accountId: Schema.String.pipe(T.HttpPath("account_id")),
    count: Schema.optional(Schema.Number).pipe(T.HttpQuery("count")),
    cursor: Schema.optional(Schema.String).pipe(T.HttpQuery("cursor")),
}).pipe(T.Http({
    method: "GET",
    path: "/accounts/{account_id}/vectorize/v2/indexes/{indexName}/list",
}));
export const ListVectorsIndexResponse = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    count: Schema.Number,
    isTruncated: Schema.Boolean,
    totalCount: Schema.Number,
    vectors: Schema.Array(Schema.Struct({
        id: Schema.String,
    })),
    cursorExpirationTimestamp: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
    nextCursor: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
}).pipe(T.ResponsePath("result"));
export const listVectorsIndex = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: ListVectorsIndexRequest,
    output: ListVectorsIndexResponse,
    errors: [],
}));
//# sourceMappingURL=vectorize.js.map