/**
 * Template Marketplace Service
 *
 * Full CRUD lifecycle for team configuration templates.
 * Templates are stored as JSON files under ~/.crewly/marketplace/templates/.
 * Each template has a store entry and a versions subdirectory containing
 * version history with config JSON and changelogs.
 *
 * Supports content-type templates (e.g. e-commerce UGC video team)
 * through the metadata field and category system.
 *
 * @module services/marketplace/template-marketplace.service
 */
import type { MarketplaceTemplate, TemplateVersion, TemplateStore, TemplateVersionStore, TemplateFilter, TemplateOperationResult, TemplateCategory, TemplatePricing } from '../../types/marketplace.types.js';
/**
 * Loads the template store from disk.
 *
 * Returns an empty store if the file does not exist or cannot be parsed.
 *
 * @returns The template store
 */
export declare function loadTemplateStore(): Promise<TemplateStore>;
/**
 * Saves the template store to disk.
 *
 * Creates the templates directory if it does not exist.
 *
 * @param store - The store to persist
 */
export declare function saveTemplateStore(store: TemplateStore): Promise<void>;
/**
 * Loads the version store for a specific template.
 *
 * Returns an empty store if the file does not exist or cannot be parsed.
 *
 * @param templateId - The template ID
 * @returns The version store for the template
 */
export declare function loadVersionStore(templateId: string): Promise<TemplateVersionStore>;
/**
 * Saves the version store for a specific template.
 *
 * Creates the template versions directory if it does not exist.
 *
 * @param templateId - The template ID
 * @param store - The version store to persist
 */
export declare function saveVersionStore(templateId: string, store: TemplateVersionStore): Promise<void>;
/**
 * Creates a new marketplace template in draft status.
 *
 * Generates a unique ID, sets initial metadata, and creates
 * the first version (1.0.0) with the provided config.
 *
 * @param input - Template creation input
 * @returns Operation result with the created template
 */
export declare function createTemplate(input: {
    name: string;
    description: string;
    author: string;
    category: TemplateCategory;
    tags?: string[];
    pricing?: TemplatePricing;
    config?: Record<string, unknown>;
    icon?: string;
    metadata?: Record<string, unknown>;
}): Promise<TemplateOperationResult>;
/**
 * Lists templates with optional filtering and sorting.
 *
 * Supports filtering by category, status, author, and free-text search.
 * Results are sorted by the specified sort option (default: newest).
 *
 * @param filter - Optional filter criteria
 * @returns Filtered and sorted templates
 */
export declare function listTemplates(filter?: TemplateFilter): Promise<MarketplaceTemplate[]>;
/**
 * Gets a single template by ID.
 *
 * @param id - The template ID
 * @returns The template, or null if not found
 */
export declare function getTemplate(id: string): Promise<MarketplaceTemplate | null>;
/**
 * Updates a template's metadata (name, description, tags, etc.).
 *
 * Cannot update archived templates. Only mutable fields are updated;
 * immutable fields (id, createdAt, downloads, rating) are preserved.
 *
 * @param id - The template ID to update
 * @param updates - Partial template updates
 * @returns Operation result with the updated template
 */
export declare function updateTemplate(id: string, updates: Partial<Pick<MarketplaceTemplate, 'name' | 'description' | 'category' | 'tags' | 'pricing' | 'icon' | 'metadata'>>): Promise<TemplateOperationResult>;
/**
 * Archives a template (soft delete).
 *
 * Sets status to 'archived'. Already archived templates return an error.
 *
 * @param id - The template ID to archive
 * @returns Operation result with the archived template
 */
export declare function archiveTemplate(id: string): Promise<TemplateOperationResult>;
/**
 * Adds a new version to a template.
 *
 * Validates the semver format and ensures versions are unique.
 * Updates the template's currentVersion to the new semver.
 *
 * @param templateId - The template ID
 * @param input - Version creation input
 * @returns Operation result with the created version
 */
export declare function addVersion(templateId: string, input: {
    semver: string;
    config: Record<string, unknown>;
    changelog: string;
}): Promise<TemplateOperationResult>;
/**
 * Lists all versions for a template, sorted newest first.
 *
 * @param templateId - The template ID
 * @returns Array of template versions, or null if template not found
 */
export declare function listVersions(templateId: string): Promise<TemplateVersion[] | null>;
/**
 * Publishes a template by transitioning its status through the
 * publish workflow: draft -> review -> published.
 *
 * A draft template moves to 'review'. A template in 'review' moves
 * to 'published'. Already published or archived templates return an error.
 *
 * @param id - The template ID to publish
 * @returns Operation result with the updated template
 */
export declare function publishTemplate(id: string): Promise<TemplateOperationResult>;
/**
 * Deletes a template and all its version data from disk.
 *
 * This is a hard delete — removes the template entry from the store
 * and its entire version directory. Use archiveTemplate for soft delete.
 *
 * @param id - The template ID to delete
 * @returns Operation result
 */
export declare function deleteTemplate(id: string): Promise<TemplateOperationResult>;
//# sourceMappingURL=template-marketplace.service.d.ts.map