/**
 * slides/12-langsmith.js
 * ----------------------------------------------------------------------------
 * Slide 12 -- LangSmith setup + API keys + snapshot
 * Account creation and runtime config.
 */
'use strict';

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

function buildLangSmithSetup(pres, theme) {
  const slide = pres.addSlide();
  helpers.slideBase(slide, pres, theme);
  helpers.addHeader(slide, pres, theme, {
    eyebrow: 'STAGE 4',
    sectionNumber: 4,
    title: 'LangSmith: setup',
  });

  helpers.addCodeBlock(slide, pres, theme, {
    x: 0.5, y: layouts.CONTENT_TOP, w: 5.6, h: 3.5,
    language: 'bash',
    code: [
      '# .env (НЕ коммитить)',
      'LANGSMITH_TRACING=true',
      'LANGSMITH_ENDPOINT=https://',
      '    api.smith.langchain.com',
      'LANGSMITH_API_KEY=lsv2_...',
      'LANGSMITH_PROJECT=open-swe-prod',
      'LANGSMITH_SNAPSHOT=true',
      '',
      '# для sandbox-прокси:',
      'LANGSMITH_SANDBOX_BACKEND=true',
    ].join('\n'),
    filePath: '.env',
    startLine: 1,
  });

  helpers.addCallout(slide, pres, theme, {
    x: 6.3, y: layouts.CONTENT_TOP, w: 3.2, h: 1.5,
    kind: 'info',
    title: 'Зачем snapshot',
    text:
      'Каждый thread = checkpoint. ' +
      'Follow-up из всех каналов ' +
      'подхватывают состояние ' +
      'по thread_id.',
  });

  helpers.addCallout(slide, pres, theme, {
    x: 6.3, y: 2.85, w: 3.2, h: 2.0,
    kind: 'success',
    title: 'API keys',
    text:
      '* Personal -- smith.langchain.com\n' +
      '* Org-level -- shared tracing\n' +
      '* Service -- для CI / batch\n' +
      'Rotate каждые 90 дней.',
  });

  helpers.addPageNumber(slide, pres, theme, 12);
  helpers.addSourceLine(slide, pres, theme, {
    source: 'docs.smith.langchain.com',
  });
  return slide;
}

module.exports = { buildLangSmithSetup };
