/**
 * Mock agent outputs for integration testing
 * Simulates various gate execution results
 */

export interface MockAgentOutput {
  output: string;
  exitCode: number;
}

export const MOCK_OUTPUTS = {
  buildSuccess: {
    output: `
✓ Build completed successfully
  Time: 3.2s
  Artifacts: dist/main.js
`,
    exitCode: 0,
  },
  buildFailure: {
    output: `
✗ Build failed
  src/feature.ts:15:7 - error TS2304: Cannot find name 'foo'.
  src/feature.ts:28:12 - error TS2339: Property 'bar' does not exist on type 'FeatureService'.

  Found 2 errors in 1 file.
`,
    exitCode: 1,
  },
  lintSuccess: {
    output: `
✓ ESLint check passed
  0 problems (0 errors, 0 warnings)
  15 files checked
`,
    exitCode: 0,
  },
  lintFailure: {
    output: `
✗ ESLint check failed
  src/feature.ts
    15:7   error  'foo' is not defined  no-undef
    28:12  error  Missing return type   @typescript-eslint/explicit-function-return-type

  12 errors and 5 warnings found
`,
    exitCode: 1,
  },
  testSuccess: {
    output: `
 PASS  src/feature.spec.ts
  FeatureService
    ✓ should create feature (15ms)
    ✓ should update feature (12ms)
    ✓ should delete feature (8ms)

Test Suites: 1 passed, 1 total
Tests:       50 passed, 50 total
Snapshots:   0 total
Time:        4.521 s
`,
    exitCode: 0,
  },
  testFailure: {
    output: `
 FAIL  src/feature.spec.ts
  FeatureService
    ✓ should create feature (15ms)
    ✗ should update feature (12ms)
    ✗ should delete feature (8ms)

  ● FeatureService › should update feature

    expect(received).toBe(expected)

    Expected: "updated"
    Received: "created"

Test Suites: 1 failed, 1 total
Tests:       45 passed, 5 failed, 50 total
Snapshots:   0 total
Time:        4.521 s
`,
    exitCode: 1,
  },
  coveragePass: {
    output: `
--------------------|---------|----------|---------|---------|-------------------
File                | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
--------------------|---------|----------|---------|---------|-------------------
All files           |   87.45 |    85.23 |   90.12 |   86.78 |
 feature.service.ts |   92.31 |    88.89 |   95.00 |   91.67 | 45-48
 feature.module.ts  |   82.14 |    81.25 |   85.71 |   81.82 | 12,34
--------------------|---------|----------|---------|---------|-------------------
`,
    exitCode: 0,
  },
  coverageFail: {
    output: `
--------------------|---------|----------|---------|---------|-------------------
File                | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
--------------------|---------|----------|---------|---------|-------------------
All files           |   72.15 |    68.42 |   75.23 |   70.89 |
 feature.service.ts |   65.38 |    60.00 |   70.00 |   64.29 | 15-28,45-62
 feature.module.ts  |   78.57 |    75.00 |   80.00 |   77.27 | 12,34,56
--------------------|---------|----------|---------|---------|-------------------
`,
    exitCode: 0,
  },
  securityPass: {
    output: `
✓ Security audit passed
  0 vulnerabilities found
  Scanned 1,245 packages
`,
    exitCode: 0,
  },
  securityFailure: {
    output: `
✗ Security audit failed
  found 3 high severity vulnerabilities

  lodash  <4.17.21
  Severity: high
  Prototype Pollution - https://github.com/advisories/GHSA-xxxxx

  Run npm audit fix to fix them
`,
    exitCode: 1,
  },
  typeCheckSuccess: {
    output: `
✓ Type check passed
  No type errors found
  Checked 45 files
`,
    exitCode: 0,
  },
  typeCheckFailure: {
    output: `
✗ Type check failed
  src/feature.ts:15:7 - error TS2322: Type 'string' is not assignable to type 'number'.
  src/feature.ts:28:12 - error TS2345: Argument of type 'undefined' is not assignable to parameter of type 'string'.

  Found 2 errors in 1 file.
`,
    exitCode: 1,
  },
};

export const MOCK_FILE_CHANGES = {
  minimal: ["src/feature.ts"],
  withTests: ["src/feature.ts", "src/feature.spec.ts"],
  withDocs: ["src/feature.ts", "src/feature.spec.ts", "README.md"],
  multiFile: [
    "src/feature.ts",
    "src/feature.spec.ts",
    "src/feature.module.ts",
    "src/feature.controller.ts",
    "src/feature.dto.ts",
  ],
};
