/**
 * Validation Type Definitions
 *
 * Types for manifest validation and error reporting.
 *
 * @module registry/types/validation
 * @version 2.0.0
 */
/**
 * Type guard to check if issue is an error
 */
export function isError(issue) {
    return issue.severity === 'error';
}
/**
 * Type guard to check if issue is a warning
 */
export function isWarning(issue) {
    return issue.severity === 'warning';
}
/**
 * Type guard to check if issue is info
 */
export function isInfo(issue) {
    return issue.severity === 'info';
}
/**
 * Helper to filter issues by severity
 */
export function filterBySeverity(issues, severity) {
    return issues.filter(issue => issue.severity === severity);
}
/**
 * Helper to filter issues by stage
 */
export function filterByStage(issues, stage) {
    return issues.filter(issue => issue.stage === stage);
}
/**
 * Helper to check if validation result has errors
 */
export function hasErrors(result) {
    return result.errors.length > 0;
}
/**
 * Helper to check if validation result has warnings
 */
export function hasWarnings(result) {
    return result.warnings.length > 0;
}
/**
 * Helper to get total issue count
 */
export function getTotalIssues(result) {
    return result.errors.length + result.warnings.length + result.info.length;
}
/**
 * Helper to merge multiple validation results
 */
export function mergeResults(...results) {
    const merged = {
        valid: true,
        errors: [],
        warnings: [],
        info: []
    };
    for (const result of results) {
        merged.errors.push(...result.errors);
        merged.warnings.push(...result.warnings);
        merged.info.push(...result.info);
    }
    merged.valid = merged.errors.length === 0;
    return merged;
}
/**
 * Helper to create a validation issue
 */
export function createIssue(code, severity, stage, title, message, file = 'manifests/implementation.yaml', line = 0, column = 0) {
    return {
        code,
        severity,
        stage,
        title,
        message,
        file,
        line,
        column
    };
}
/**
 * Helper to add suggestions to an issue
 */
export function withSuggestions(issue, suggestions) {
    return {
        ...issue,
        suggestions
    };
}
/**
 * Helper to add fix command to an issue
 */
export function withFix(issue, fix) {
    return {
        ...issue,
        fix
    };
}
/**
 * Helper to add learn more URL to an issue
 */
export function withLearnMore(issue, url) {
    return {
        ...issue,
        learnMoreUrl: url
    };
}
/**
 * Error code constants
 */
export const ErrorCodes = {
    // Stage 2: Manifest validation
    FACTORY_NOT_FOUND: 'MANIFEST-001',
    FACTORY_DEPRECATED: 'MANIFEST-002',
    INVALID_CAPABILITY_MAPPING: 'MANIFEST-004',
    NETWORK_ERROR: 'MANIFEST-005',
    STALE_CACHE: 'MANIFEST-006',
    // Stage 3: Installation validation
    PACKAGE_NOT_INSTALLED: 'REALIZE-001',
    FACTORY_FILE_NOT_FOUND: 'REALIZE-002',
    VERSION_MISMATCH: 'REALIZE-003'
};
/**
 * Learn more URLs
 */
export const LearnMoreUrls = {
    REGISTRY: 'https://registry.specverse.com/factories',
    MIGRATION: 'https://docs.specverse.com/migration',
    CAPABILITIES: 'https://docs.specverse.com/capabilities'
};
//# sourceMappingURL=validation.js.map