import type Database from 'better-sqlite3';
import type { EntityType, Tag, TagCreateInput, TagUpdateInput } from '../../shared/entities.js';
export declare class TagsService {
    private db;
    constructor(db: Database.Database);
    list(): Tag[];
    getBySlug(slug: string): Tag | null;
    getIdBySlug(slug: string): number | null;
    create(input: TagCreateInput): Tag;
    /** Idempotent: returns existing tag if already present. */
    ensure(name: string): Tag;
    update(slug: string, input: TagUpdateInput): Tag;
    remove(slug: string): {
        deleted: true;
        affectedEntities: number;
    };
    /** Sets the tag set of an entity to exactly `tagNames` (auto-creating missing tags). */
    assignTags(entityType: EntityType, entityId: number, tagNames: string[]): string[];
    getEntityTagSlugs(entityType: EntityType, entityId: number): string[];
    private countsByTagSlug;
    private pickColor;
    private toTag;
}
export declare class DomainError extends Error {
    code: string;
    constructor(code: string, message: string);
}
