// tools/generate-tests/spec-dispatcher.ts — Orchestrator for spec-specific test generation
// Delegates to domain-grouped sub-dispatchers in ./dispatchers/
import { dispatchAiMl } from './dispatchers/ai-ml-dispatcher.js';
import { dispatchFrontend } from './dispatchers/frontend-dispatcher.js';
import { dispatchProtocols } from './dispatchers/protocols-dispatcher.js';
import { dispatchDistributed } from './dispatchers/distributed-dispatcher.js';
import { dispatchInfra } from './dispatchers/infra-dispatcher.js';
import { dispatchDatabaseSecurity } from './dispatchers/database-security-dispatcher.js';
import { buildPropertyBasedTestFile } from './generators/property-based-generator.js';
/**
 * Runs all spec-specific test generation dispatchers.
 * Mutates unitTests, integrationTests, testFiles in-place.
 * Returns { isApiSpec } for use in output formatting.
 *
 * When strategy='property-based', skips domain dispatchers and generates
 * property tests derived from acceptance criteria invariants.
 */
export function runSpecializedGenerators(args, unitTests, integrationTests, testFiles) {
    const { spec, knowledge, testDir, testFramework, slug, autoGenerate, testExt, strategy } = args;
    // SPEC-315: property-based strategy — generate invariant-driven tests from AC
    if (strategy === 'property-based') {
        testFiles.push(buildPropertyBasedTestFile(spec, knowledge, testDir, autoGenerate));
        unitTests.push({
            name: `${spec.title} — property: invariants hold for all valid inputs`,
            type: 'unit',
            file: `${testDir}/property/`,
            description: 'Verify invariant properties using property-based testing',
            priority: 'high',
            automatable: true,
        });
        return { isApiSpec: false };
    }
    dispatchAiMl(spec, knowledge, testDir, testFramework, slug, autoGenerate, testExt, unitTests, integrationTests, testFiles);
    dispatchFrontend(spec, knowledge, testDir, testFramework, slug, autoGenerate, testExt, unitTests, integrationTests, testFiles);
    dispatchDistributed(spec, knowledge, testDir, testFramework, slug, autoGenerate, testExt, unitTests, integrationTests, testFiles);
    dispatchProtocols(spec, knowledge, testDir, testFramework, slug, autoGenerate, testExt, unitTests, integrationTests, testFiles);
    dispatchInfra(spec, knowledge, testDir, testFramework, slug, autoGenerate, testExt, unitTests, integrationTests, testFiles);
    return dispatchDatabaseSecurity(spec, knowledge, testDir, testFramework, slug, autoGenerate, testExt, unitTests, integrationTests, testFiles);
}
//# sourceMappingURL=spec-dispatcher.js.map