/**
 * slides/21-production-ready.js
 * ----------------------------------------------------------------------------
 * Slide 21 -- Production: чеклист prod-ready
 */
'use strict';

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

function buildProductionReady(pres, theme) {
  const slide = pres.addSlide();
  helpers.slideBase(slide, pres, theme);
  helpers.addHeader(slide, pres, theme, {
    eyebrow: 'STAGE 4',
    sectionNumber: 4,
    title: 'Production: prod-ready',
  });

  // Two columns of checklist items
  const leftItems = [
    'docker-compose / k8s',
    'managed Postgres',
    'Vault / sealed-secrets',
    'TLS + reverse proxy',
    'rate limit на /webhooks/*',
    'idempotency keys',
  ];

  const rightItems = [
    'LangSmith prod-project',
    'Datadog dashboards + SLO',
    'sandbox cost budget',
    'audit log всех PR',
    'docs: runbook, on-call',
    'load test 100 threads',
  ];

  helpers.addCallout(slide, pres, theme, {
    x: 0.5, y: layouts.CONTENT_TOP, w: 4.4, h: 1.6,
    kind: 'success',
    title: 'Infra',
    text: leftItems.map(function (i) { return '+ ' + i; }).join('\n'),
  });

  helpers.addCallout(slide, pres, theme, {
    x: 5.1, y: layouts.CONTENT_TOP, w: 4.4, h: 1.6,
    kind: 'info',
    title: 'Ops',
    text: rightItems.map(function (i) { return '+ ' + i; }).join('\n'),
  });

  helpers.addCallout(slide, pres, theme, {
    x: 0.5, y: 3.15, w: 9.0, h: 1.7,
    kind: 'warning',
    title: 'Самый частый пропуск',
    text:
      '"Trust the LLM" внутри sandbox. ' +
      'Без надлежащей изоляции (seccomp, ' +
      'network policy, ephemeral FS) агент ' +
      'может сделать rm -rf или curl внутренних ' +
      'сервисов. Изоляция важнее prompts.',
  });

  helpers.addPageNumber(slide, pres, theme, 21);
  helpers.addSourceLine(slide, pres, theme, {
    source: 'production-readiness checklist + SRE playbook',
  });
  return slide;
}

module.exports = { buildProductionReady };
