// engine/advanced-testing/test-data-advisor.ts — SPEC-049
// Provides test data management criteria and synthetic data tooling recommendations.
/** PII/PHI signals in stack or project descriptions. */
const PII_SIGNALS = [
    'pii',
    'phi',
    'gdpr',
    'hipaa',
    'personal data',
    'sensitive',
    'user data',
    'patient',
    'medical',
    'financial',
    'payment',
    'credit card',
    'ssn',
    'social security',
];
/** Check if the project involves sensitive/PII data. */
export function hasPiiSignals(stack, description) {
    const text = [...stack, description ?? ''].join(' ').toLowerCase();
    return PII_SIGNALS.some((sig) => text.includes(sig));
}
/**
 * Build the test data management criteria for create_spec.
 * These criteria enforce no production data and factory-based test data.
 */
export function buildTestDataCriteria() {
    return [
        '- [ ] Los tests no usan datos reales de producción — usan synthetic data generada programáticamente (requisito GDPR/HIPAA)',
        '- [ ] Los fixtures de tests se generan con factories (factory_boy para Python, fishery/factory.ts para JS/TS) — no con archivos JSON estáticos hardcodeados',
        '- [ ] Los datos sensibles en tests usan data masking o valores fake consistentes (Faker/Mimesis/Fakr)',
        '- [ ] Los seeds de base de datos de test son deterministas — misma semilla siempre genera mismos datos',
        '- [ ] Las factories pueden generar datos edge-case: campos vacíos, caracteres unicode, longitudes máximas',
    ];
}
/** JS/TS test data tools. */
function jsTestDataTools() {
    return [
        {
            name: '@faker-js/faker',
            description: 'Faker for JavaScript/TypeScript — generate realistic fake data',
            category: 'test-data',
            installCommand: 'pnpm add -D @faker-js/faker',
            docsUrl: 'https://fakerjs.dev',
            recommended: true,
        },
        {
            name: 'fishery',
            description: 'TypeScript factory library with trait support (factory_boy for TS)',
            category: 'test-data',
            installCommand: 'pnpm add -D fishery',
            docsUrl: 'https://github.com/thoughtbot/fishery',
            recommended: true,
        },
    ];
}
/** Python test data tools. */
function pythonTestDataTools() {
    return [
        {
            name: 'Faker',
            description: 'Faker for Python — 100+ locales, most popular fake data library',
            category: 'test-data',
            installCommand: 'pip install faker',
            docsUrl: 'https://faker.readthedocs.io',
            recommended: true,
        },
        {
            name: 'factory_boy',
            description: 'Factory library for Django/SQLAlchemy — declarative test fixtures',
            category: 'test-data',
            installCommand: 'pip install factory_boy',
            docsUrl: 'https://factoryboy.readthedocs.io',
            recommended: true,
        },
        {
            name: 'Mimesis',
            description: 'High-performance fake data — 100+ locales, faster than Faker',
            category: 'test-data',
            installCommand: 'pip install mimesis',
            docsUrl: 'https://mimesis.name',
            recommended: false,
        },
    ];
}
/**
 * Map a language to synthetic data tooling recommendations.
 */
export function getTestDataTooling(language) {
    const lang = language.toLowerCase();
    if (lang === 'typescript' || lang === 'javascript') {
        return jsTestDataTools();
    }
    if (lang === 'python') {
        return pythonTestDataTools();
    }
    if (lang === 'go') {
        return [
            {
                name: 'go-faker',
                description: 'Faker for Go — simple fake data generation',
                category: 'test-data',
                installCommand: 'go get github.com/brianvoe/gofakeit/v6',
                docsUrl: 'https://github.com/brianvoe/gofakeit',
                recommended: true,
            },
        ];
    }
    if (lang === 'java' || lang === 'kotlin') {
        return [
            {
                name: 'JavaFaker',
                description: 'Java port of Faker — widely used for test data',
                category: 'test-data',
                installCommand: 'implementation("com.github.javafaker:javafaker:1.0.2")',
                docsUrl: 'https://github.com/DiUS/java-faker',
                recommended: true,
            },
        ];
    }
    return [
        {
            name: 'Faker',
            description: 'Cross-language fake data generation (Python/JS/Go/Ruby)',
            category: 'test-data',
            installCommand: 'See https://github.com/faker-ruby/faker for language-specific packages',
            docsUrl: 'https://fakerjs.dev',
            recommended: true,
        },
    ];
}
/** Get AI-assisted test generation tooling recommendations (language-agnostic). */
export function getAiTestingTooling() {
    return [
        {
            name: 'Keploy',
            description: 'Captures real traffic and generates tests automatically — supports Go/Java/Node/Python',
            category: 'ai-testing',
            installCommand: 'curl --silent --location "https://get.keploy.io" | bash',
            docsUrl: 'https://keploy.io/docs',
            recommended: true,
        },
        {
            name: 'CodiumAI',
            description: 'AI unit test generation from existing code — VS Code / JetBrains plugin',
            category: 'ai-testing',
            installCommand: 'Install via IDE marketplace',
            docsUrl: 'https://www.codium.ai',
            recommended: false,
        },
        {
            name: 'Qodo (formerly CodiumAI)',
            description: 'AI-powered test suggestions for PRs — GitHub App integration',
            category: 'ai-testing',
            installCommand: 'Install via GitHub Marketplace',
            docsUrl: 'https://qodo.ai',
            recommended: false,
        },
    ];
}
//# sourceMappingURL=test-data-advisor.js.map