/**
 * slides/04-create-deep-agent.js
 * ----------------------------------------------------------------------------
 * Slide 04 -- create_deep_agent: composition point
 * Core entry point with sandbox + middleware.
 */
'use strict';

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

function buildCreateDeepAgent(pres, theme) {
  const slide = pres.addSlide();
  helpers.slideBase(slide, pres, theme);
  helpers.addHeader(slide, pres, theme, {
    eyebrow: 'STAGE 4',
    sectionNumber: 4,
    title: 'create_deep_agent + backend',
  });

  helpers.addCodeBlock(slide, pres, theme, {
    x: 0.5, y: layouts.CONTENT_TOP, w: 6.0, h: 3.5,
    language: 'python',
    code: [
      'from deepagents import create_deep_agent',
      'from open_swe.sandbox import DaytonaBackend',
      '',
      'agent = create_deep_agent(',
      '    model="anthropic:claude-opus-4-6",',
      '    tools=[execute, fetch_url,',
      '           linear_comment,',
      '           slack_thread_reply],',
      '    backend=DaytonaBackend(api_key="..."),',
      '    middleware=[open_pr_if_needed],',
      ')',
    ].join('\n'),
    filePath: 'examples/minimal_agent.py',
    startLine: 1,
    highlightLines: [4, 8, 9],
  });

  helpers.addCallout(slide, pres, theme, {
    x: 6.8, y: layouts.CONTENT_TOP, w: 2.7, h: 1.4,
    kind: 'info',
    title: 'Один harness',
    text:
      'Март 2026: multi-agent ' +
      '(Manager/Planner/Programmer/' +
      'Reviewer) заменили на единый ' +
      'deep-agent harness.',
  });

  helpers.addCallout(slide, pres, theme, {
    x: 6.8, y: 2.9, w: 2.7, h: 1.55,
    kind: 'success',
    title: 'Upgrade path',
    text:
      'Подтягиваешь улучшения Deep ' +
      'Agents бесплатно. Subagents ' +
      'изолируют контекст, middleware ' +
      'дают orchestration.',
  });

  helpers.addPageNumber(slide, pres, theme, 4);
  helpers.addSourceLine(slide, pres, theme, {
    source: 'research/per-tech/openswe.md: 52-77',
  });
  return slide;
}

module.exports = { buildCreateDeepAgent };
