/**
 * slides/10-installation-2.js
 * ----------------------------------------------------------------------------
 * Slide 10 -- Installation: services up + UI
 * Steps 3-5 of 5.
 */
'use strict';

const { helpers, layouts } = require('../../design-system');

function buildInstallPart2(pres, theme) {
  const slide = pres.addSlide();
  helpers.slideBase(slide, pres, theme);
  helpers.addHeader(slide, pres, theme, {
    eyebrow: 'STAGE 4',
    sectionNumber: 4,
    title: 'Установка (2/2): шаги 3-5',
  });

  helpers.addCodeBlock(slide, pres, theme, {
    x: 0.5, y: layouts.CONTENT_TOP, w: 6.0, h: 3.5,
    language: 'bash',
    code: [
      '# 3. backend (FastAPI)',
      'uv run apps/open-swe/main.py',
      '# -> :8000',
      '',
      '# 4. UI (TanStack Start + Vite)',
      'cd apps/open-swe-ui',
      'pnpm install && pnpm dev',
      '# -> :3000',
      '',
      '# 5. smoke-test',
      'curl -X POST :8000/webhooks/slack \\',
      '  -d \'{"text":"@open-swe hello"}\'',
      '# -> {"thread_id": "..."}',
    ].join('\n'),
    filePath: 'INSTALLATION.md: steps 3-5',
    startLine: 1,
  });

  helpers.addCallout(slide, pres, theme, {
    x: 6.7, y: layouts.CONTENT_TOP, w: 2.8, h: 1.7,
    kind: 'success',
    title: 'Готово',
    text:
      'Backend :8000\n' +
      'UI :3000\n' +
      'Webhook :8000/webhooks/*\n\n' +
      'Можно слать @open-swe.',
  });

  helpers.addCallout(slide, pres, theme, {
    x: 6.7, y: 3.0, w: 2.8, h: 1.85,
    kind: 'info',
    title: 'Production',
    text:
      'Локальный запуск -- только dev. ' +
      'Для prod: docker compose, k8s, ' +
      'managed Postgres, Vault, TLS.',
  });

  helpers.addPageNumber(slide, pres, theme, 10);
  helpers.addSourceLine(slide, pres, theme, {
    source: 'INSTALLATION.md + INSTALLATION in repo root',
  });
  return slide;
}

module.exports = { buildInstallPart2 };
