<?php

return function($page) {  
  if ($page->template() == "project") {
    kirby()->impersonate('kirby');
    
    $brief = $page->createChild([
      'slug' => 'client-brief',
      'template' => 'client-brief',
      'content' => [
        'title' => 'Brief client',
        'stepName' => 'clientBrief',
        'stepIndex' => 1
      ],
    ])->changeStatus('listed');
    
    $page->createChild([
      'slug' => 'proposal',
      'template' => 'proposal',
      'content' => [
        'title' => 'Offre commerciale',
        'stepName' => 'proposal',
        'stepIndex' => 2
      ]
    ])->changeStatus('listed');
    
    $page->createChild([
      'slug' => 'extended-brief',
      'template' => 'extended-brief',
      'content' => [
        'title' => 'Brief enrichi',
        'stepName' => 'extendedBrief',
        'stepIndex' => 3
      ]
    ])->changeStatus('listed');
    
    $page->createChild([
      'slug' => 'industrial-ideation',
      'template' => 'industrial-ideation',
      'content' => [
        'title' => 'Idéation industrielle',
        'stepName' => 'industrialIdeation',
        'stepIndex' => 4
      ]
    ]);
    
    $page->createChild([
      'slug' => 'virtual-sample',
      'template' => 'virtual-sample',
      'content' => [
        'title' => 'Échantillon virtuel',
        'stepName' => 'virtualSample',
        'stepIndex' => 5
      ]
    ])->changeStatus('listed');
    
    $page->createChild([
      'slug' => 'physical-sample',
      'template' => 'physical-sample',
      'content' => [
        'title' => 'Échantillon physique',
        'stepName' => 'physicalSample',
        'stepIndex' => 6
      ]
    ]);

    $page->update([
      "currentStep" => "clientBrief"
    ]);
  }
};