/**
 * Template Service
 *
 * Loads, lists, and applies team templates from config/templates/.
 * Supports both the new TeamTemplate format (with verificationPipeline)
 * and legacy flat JSON format (backward compatible).
 *
 * @module services/template/template
 */
import type { TeamTemplate } from '../../types/team-template.types.js';
import type { Team } from '../../types/index.js';
import { type CloudTier } from '../../constants.js';
/** Result of creating a team from a template */
export interface CreateFromTemplateResult {
    /** The created team */
    team: Team;
    /** Template ID used */
    templateId: string;
    /** Number of members created */
    memberCount: number;
}
/** Template source — local disk */
export type TemplateSource = 'local';
/** Minimal template summary for listing */
export interface TemplateSummary {
    id: string;
    name: string;
    description: string;
    category: string;
    hierarchical: boolean;
    roleCount: number;
    version: string;
    tags?: string[];
    icon?: string;
    /** Where this template was loaded from */
    source: TemplateSource;
    /** Minimum tier required to use this template */
    requiredTier?: CloudTier;
}
/**
 * TemplateService manages team templates.
 * Loads templates from config/templates/ directory, provides
 * listing/querying, and creates teams from templates.
 *
 * Singleton pattern matching other Crewly services.
 */
export declare class TemplateService {
    private static instance;
    /** Loaded templates indexed by ID */
    private templates;
    /** Templates directory path */
    private templatesDir;
    /** Whether templates have been loaded */
    private loaded;
    private constructor();
    /**
     * Get the singleton instance.
     *
     * @param templatesDir - Optional override for templates directory
     * @returns The singleton instance
     */
    static getInstance(templatesDir?: string): TemplateService;
    /**
     * Clear the singleton instance (for testing).
     */
    static clearInstance(): void;
    /**
     * Load all templates from the templates directory.
     * Scans for template.json files in subdirectories and
     * legacy flat JSON files at the root level.
     *
     * @returns Number of templates loaded
     */
    loadTemplates(): number;
    /**
     * List local templates as summaries.
     *
     * @returns Array of local template summaries
     */
    listTemplates(): TemplateSummary[];
    /**
     * Get a specific template by ID.
     *
     * @param id - Template ID
     * @returns The template, or null if not found
     */
    getTemplate(id: string): TeamTemplate | null;
    /**
     * Create a team from a template.
     * Generates TeamMember objects with IDs, session names,
     * and hierarchy fields based on the template's role definitions.
     *
     * @param templateId - ID of the template to use
     * @param teamName - Name for the new team
     * @param nameOverrides - Optional map of role to custom name
     * @returns The created team result, or null if template not found
     */
    createTeamFromTemplate(templateId: string, teamName: string, nameOverrides?: Record<string, string>, userTier?: CloudTier): CreateFromTemplateResult | null;
    /**
     * Copy norms files from a template to the team's norms directory.
     *
     * Copies config/templates/{templateId}/norms/*.md to ~/.crewly/teams/{teamId}/norms/.
     * Also copies the norms config from template.json into the team's config.json.
     *
     * @param templateId - Source template ID
     * @param teamId - Target team ID
     */
    private copyTeamNorms;
    /**
     * Load the raw template.json for a template (including norms config).
     *
     * @param templateId - Template ID
     * @returns Parsed template.json or null
     */
    private loadTemplateJson;
    /**
     * Get the number of loaded templates.
     *
     * @returns Template count
     */
    getTemplateCount(): number;
    /**
     * Load a new-format template.json file.
     *
     * @param filePath - Absolute path to the template.json file
     * @param dirName - Directory name containing the template
     */
    private loadTemplateFile;
    /**
     * Load a legacy flat JSON template (e.g., web-dev-team.json).
     * Converts to TeamTemplate format with sensible defaults.
     *
     * @param filePath - Absolute path to the JSON file
     * @param fileName - File name of the template
     */
    private loadLegacyTemplate;
}
//# sourceMappingURL=template.service.d.ts.map