/**
 * Team Template Types
 *
 * Defines the structure for team templates — reusable team recipes
 * that include roles, hierarchy configuration, and verification pipelines.
 * Templates are stored in config/templates/ and loaded by TemplateService.
 *
 * @module types/team-template
 */
export const TEMPLATE_CATEGORIES = [
    'development',
    'content',
    'research',
    'operations',
    'custom',
];
export const VERIFICATION_METHODS = [
    'quality_gates',
    'e2e_test',
    'code_review',
    'browser_test',
    'screenshot_review',
    'gemini_vision',
    'content_check',
    'fact_check',
    'source_verify',
    'data_validate',
    'manual_review',
    'custom_script',
];
// =============================================================================
// Validators
// =============================================================================
/**
 * Check if a value is a valid TemplateCategory.
 *
 * @param value - Value to check
 * @returns True if valid
 */
export function isValidTemplateCategory(value) {
    return typeof value === 'string' && TEMPLATE_CATEGORIES.includes(value);
}
/**
 * Check if a value is a valid VerificationMethod.
 *
 * @param value - Value to check
 * @returns True if valid
 */
export function isValidVerificationMethod(value) {
    return typeof value === 'string' && VERIFICATION_METHODS.includes(value);
}
/**
 * Validate a VerificationStep object.
 *
 * @param value - Value to check
 * @returns True if valid
 */
export function isValidVerificationStep(value) {
    if (!value || typeof value !== 'object')
        return false;
    const step = value;
    return (typeof step.id === 'string' && step.id.length > 0 &&
        typeof step.name === 'string' && step.name.length > 0 &&
        typeof step.description === 'string' &&
        isValidVerificationMethod(step.method) &&
        typeof step.critical === 'boolean' &&
        step.config !== null && typeof step.config === 'object');
}
/**
 * Validate a VerificationPipeline object.
 *
 * @param value - Value to check
 * @returns True if valid
 */
export function isValidVerificationPipeline(value) {
    if (!value || typeof value !== 'object')
        return false;
    const pipeline = value;
    if (typeof pipeline.name !== 'string' || pipeline.name.length === 0)
        return false;
    if (!Array.isArray(pipeline.steps) || pipeline.steps.length === 0)
        return false;
    if (!['all', 'majority', 'critical_only'].includes(pipeline.passPolicy))
        return false;
    if (typeof pipeline.maxRetries !== 'number' || pipeline.maxRetries < 0)
        return false;
    return pipeline.steps.every((s) => isValidVerificationStep(s));
}
/**
 * Validate a TemplateRole object.
 *
 * @param value - Value to check
 * @returns True if valid
 */
export function isValidTemplateRole(value) {
    if (!value || typeof value !== 'object')
        return false;
    const role = value;
    return (typeof role.role === 'string' && role.role.length > 0 &&
        typeof role.label === 'string' && role.label.length > 0 &&
        typeof role.defaultName === 'string' && role.defaultName.length > 0 &&
        typeof role.count === 'number' && role.count >= 1 &&
        typeof role.hierarchyLevel === 'number' && role.hierarchyLevel >= 0 &&
        typeof role.canDelegate === 'boolean' &&
        Array.isArray(role.defaultSkills));
}
/**
 * Validate a TeamTemplate object.
 *
 * @param value - Value to check
 * @returns True if valid
 */
export function isValidTeamTemplate(value) {
    if (!value || typeof value !== 'object')
        return false;
    const t = value;
    if (typeof t.id !== 'string' || t.id.length === 0)
        return false;
    if (typeof t.name !== 'string' || t.name.length === 0)
        return false;
    if (typeof t.description !== 'string')
        return false;
    if (!isValidTemplateCategory(t.category))
        return false;
    if (typeof t.version !== 'string')
        return false;
    if (typeof t.hierarchical !== 'boolean')
        return false;
    if (!Array.isArray(t.roles) || t.roles.length === 0)
        return false;
    if (!t.roles.every((r) => isValidTemplateRole(r)))
        return false;
    if (!['claude-code', 'gemini-cli', 'codex-cli', 'crewly-agent'].includes(t.defaultRuntime))
        return false;
    if (!isValidVerificationPipeline(t.verificationPipeline))
        return false;
    return true;
}
//# sourceMappingURL=team-template.types.js.map