/**
 * Tag Operations for DatabaseService
 *
 * Provides CRUD operations for tags and entity_tags tables.
 * Tags are user-defined annotations for cross-entity tagging.
 *
 * @module database/tag-operations
 */
import type Database from 'better-sqlite3';
export interface Tag {
    id: string;
    name: string;
    description: string | null;
    color: string | null;
    created_at: string;
}
export interface TagWithCount extends Tag {
    usage_count: number;
}
export interface EntityTagResult {
    entity_id: string;
    entity_type: string;
    tags: string[];
}
export declare const VALID_ENTITY_TYPES: readonly ["document", "chunk", "image", "extraction", "cluster"];
/**
 * Create a new tag
 * @throws Error if tag name already exists
 */
export declare function createTag(db: Database.Database, tag: {
    name: string;
    description?: string;
    color?: string;
}): Tag;
/**
 * Get a tag by its name
 */
export declare function getTagByName(db: Database.Database, name: string): Tag | null;
/**
 * Get all tags
 */
export declare function getAllTags(db: Database.Database): Tag[];
/**
 * Get all tags with usage counts
 */
export declare function getTagsWithCounts(db: Database.Database): TagWithCount[];
/**
 * Apply a tag to an entity
 * @returns The entity_tags record ID
 * @throws Error if tag/entity_tag combination already exists
 */
export declare function applyTag(db: Database.Database, tagId: string, entityId: string, entityType: string): string;
/**
 * Remove a tag from an entity
 * @returns true if a row was deleted, false if nothing to remove
 */
export declare function removeTag(db: Database.Database, tagId: string, entityId: string, entityType: string): boolean;
/**
 * Get all tags for an entity
 */
export declare function getTagsForEntity(db: Database.Database, entityId: string, entityType: string): Tag[];
/**
 * Search for entities that have specified tags
 *
 * @param tagNames - Array of tag names to search for
 * @param entityType - Optional filter by entity type
 * @param matchAll - If true, entity must have ALL tags. If false, ANY tag matches.
 */
export declare function searchByTags(db: Database.Database, tagNames: string[], entityType?: string, matchAll?: boolean): EntityTagResult[];
/**
 * Delete a tag and all its entity associations (CASCADE)
 * @returns The number of entity_tag associations that were removed
 */
export declare function deleteTag(db: Database.Database, tagId: string): number;
//# sourceMappingURL=tag-operations.d.ts.map