import type { Database } from "bun:sqlite";
import type { TaskTemplate, CreateTemplateInput, CreateTaskInput, TemplateTask, TemplateTaskInput, TemplateWithTasks, TemplateVariable, TemplateVersion, Task } from "../types/index.js";
export interface UpdateTemplateInput {
    name?: string;
    title_pattern?: string;
    description?: string | null;
    priority?: "low" | "medium" | "high" | "critical";
    tags?: string[];
    variables?: TemplateVariable[];
    project_id?: string | null;
    plan_id?: string | null;
    metadata?: Record<string, unknown>;
}
export declare function createTemplate(input: CreateTemplateInput, db?: Database): TaskTemplate;
export declare function getTemplate(id: string, db?: Database): TaskTemplate | null;
export declare function listTemplates(db?: Database): TaskTemplate[];
export declare function deleteTemplate(id: string, db?: Database): boolean;
export declare function updateTemplate(id: string, updates: UpdateTemplateInput, db?: Database): TaskTemplate | null;
export declare function taskFromTemplate(templateId: string, overrides?: Partial<CreateTaskInput>, db?: Database): CreateTaskInput;
/** Add tasks to a template, replacing any existing template tasks */
export declare function addTemplateTasks(templateId: string, tasks: TemplateTaskInput[], db?: Database): TemplateTask[];
/** Get a template with all its associated tasks, ordered by position */
export declare function getTemplateWithTasks(id: string, db?: Database): TemplateWithTasks | null;
/** Get just the template tasks for a given template ID */
export declare function getTemplateTasks(templateId: string, db?: Database): TemplateTask[];
/**
 * Evaluate a condition string against a set of variables.
 * Supported syntax:
 *   - "{var} == value" -- equals
 *   - "{var} != value" -- not equals
 *   - "{var}" -- truthy (exists and not empty/false)
 *   - "!{var}" -- falsy (doesn't exist, empty, or "false")
 */
export declare function evaluateCondition(condition: string, variables: Record<string, string>): boolean;
export interface TemplateExport {
    name: string;
    title_pattern: string;
    description: string | null;
    priority: string;
    tags: string[];
    variables: TemplateVariable[];
    project_id: string | null;
    plan_id: string | null;
    metadata: Record<string, unknown>;
    tasks: Array<{
        position: number;
        title_pattern: string;
        description: string | null;
        priority: string;
        tags: string[];
        task_type: string | null;
        condition: string | null;
        include_template_id: string | null;
        depends_on_positions: number[];
        metadata: Record<string, unknown>;
    }>;
}
/** Export a template as a full JSON-serializable object */
export declare function exportTemplate(id: string, db?: Database): TemplateExport;
/** Import a template from a JSON object, generating new IDs */
export declare function importTemplate(json: TemplateExport, db?: Database): TaskTemplate;
/** Get a specific version of a template */
export declare function getTemplateVersion(id: string, version: number, db?: Database): TemplateVersion | null;
/** List all versions of a template */
export declare function listTemplateVersions(id: string, db?: Database): TemplateVersion[];
/**
 * Validate required variables are provided and fill in defaults.
 * Returns the merged variables map ready for substitution.
 * Throws if required variables are missing.
 */
export declare function resolveVariables(templateVars: TemplateVariable[], provided?: Record<string, string>): Record<string, string>;
/**
 * Create all tasks from a multi-task template.
 * Supports conditional tasks, template composition, and variable substitution.
 */
export declare function tasksFromTemplate(templateId: string, projectId?: string, variables?: Record<string, string>, taskListId?: string, db?: Database, _visitedTemplateIds?: Set<string>): Task[];
/**
 * Preview a template -- returns the resolved task list WITHOUT creating anything.
 */
export interface TemplatePreviewTask {
    position: number;
    title: string;
    description: string | null;
    priority: string;
    tags: string[];
    task_type: string | null;
    depends_on_positions: number[];
}
export interface TemplatePreview {
    template_id: string;
    template_name: string;
    description: string | null;
    variables: TemplateVariable[];
    resolved_variables: Record<string, string>;
    tasks: TemplatePreviewTask[];
}
export declare function previewTemplate(templateId: string, variables?: Record<string, string>, db?: Database): TemplatePreview;
//# sourceMappingURL=templates.d.ts.map